I'm struggling with forecasting out of sample values with an ARMAX model.
Fitting the model works fine.
armax_mod31 = sm.tsa.ARMA(endog = sales, order = (3,1), exog = media).fit()
armax_mod31.fittedvalues
Forecasting without exogenous values, as far as I have an according model, works fine as well.
arma_mod31 = sm.tsa.ARMA(sales, (3,1)).fit()
all_arma = arma_mod31.forecast(steps = 14, alpha = 0.05)
forecast_arma = Series(res_arma[0], index = pd.date_range(start = "2013-08-21", periods = 14))
ci_arma = DataFrame(res_arma[2], columns = ["lower", "upper"])
However as soon as I want to predict out of sample values I run into problems.
all_armax = armax_mod31.forecast(steps = 14, alpha = 0.05, exog = media_out)
leads to "ValueError: matrices are not aligned".
My first idea was, that the length of *media_out* does not fit. I checked it several times and tried out to pass other series as exog. Length of exog is the same as number of steps. I tried out a time series and also only *media_out.values*.
Checked the documentation:
"exog : array
If the model is an ARMAX, you must provide out of sample
values for the exogenous variables. This should not include
the constant."
As far as I understand this is what I do. Any ideas what I'm doing wrong? In addition I found this ipython notebook http://nbviewer.ipython.org/cb6e9b476a41586958b5 while looking for a solution on the web. On In [53]: you can see a similar error. The author's comment suggests a general problem with out-of-sample prediction, am I right?
I'm running python 2.7.3, pandas 0.12.0-1 and statsmodels 0.5.0-1.