python - ARMA out-of-sample prediction with statsmodels -
i'm using statsmodels fit arma model.
import statsmodels.api sm arma = sm.tsa.arma(data, order =(4,4)); results = arma.fit( full_output=false, disp=0);
where data
one-dimensional array. know in-sample predictions:
pred = results.predict();
now, given second data set data2
, how can use calibrated model generate series forecasts (predictions) based in observations?
i thought there issue this. if file 1 on github, i'll more remember add this. prediction machinery not (yet) available user-facing functions, you'd have this.
if you've fit model already, can this.
# nsteps ahead predictor function statsmodels.tsa.arima_model import _arma_predict_out_of_sample res = sm.tsa.arma(y, (3, 2)).fit(trend="nc") # need predicting one-step ahead params = res.params residuals = res.resid p = res.k_ar q = res.k_ma k_exog = res.k_exog k_trend = res.k_trend steps = 1 _arma_predict_out_of_sample(params, steps, residuals, p, q, k_trend, k_exog, endog=y, exog=none, start=len(y))
this new prediction 1 step ahead. can tack on y, , you'll need update residuals.
Comments
Post a Comment