Fitting an arimax model on out of sample dataset
I have built an arimax model where we have sales data across time as the response variable and price is one of the external variables. I used the below code to build a simple arimax model. I had data points from 1 to 24, I have kept only 1 to 20 data points in the training dataset
library(stats)
fit=arima(window(tssales, end=20), order = c(0,1,1), xreg = window(tsprice, end=20))
summary(fit)
fcast=forecast(fit, h=5, xreg = window(tsprice, end=20))
plot(fcast)
Now when I try to fit the model from the training dataset in out of sample dataset (last 4 data points) I use the below code
library(stats)
out_of_sample=arima(window(tssales, start=21), xreg = window(tsprice, start=21), model=fit)
I am getting the following error
Error in arima(window(tssales, start = 21), xreg = window(tsprice, start = 21), : unused argument (model = fit)
Topic forecast time-series r
Category Data Science