1 year ago
#351895
manager_matt
sm.tsa.arima.ARIMA model fit forecast cannot set/save fc, se, conf after forecast()
** Problem **
Seeking to have return values from ARIMA model fit / forecast; namely 'fc', 'se', 'conf' from '= model_fit.forecast()'.
** ARIMA Model Works **
from statsmodels.tsa.arima_model import ARIMA
import statsmodels.api as sm
model = sm.tsa.arima.ARIMA(wd.weather_data['prcp'], order=(2,1,1))
** Model fit provides **
model_fit = model.fit()
SARIMAX Results
Dep. Variable: prcp No. Observations: 151802
Model: ARIMA(2, 1, 1) Log Likelihood -516358.209
Date: Tue, 29 Mar 2022 AIC 1032724.419
Time: 23:13:35 BIC 1032764.140
Sample: 0 HQIC 1032736.251
- 151802
Covariance Type: opg
coef std err z P>|z| [0.025 0.975]
ar.L1 0.1559 0.001 158.370 0.000 0.154 0.158
ar.L2 -0.0030 0.001 -2.195 0.028 -0.006 -0.000
ma.L1 -0.9916 0.000 -3414.610 0.000 -0.992 -0.991
sigma2 52.7300 0.026 2008.147 0.000 52.679 52.781
Ljung-Box (L1) (Q): 0.00 Jarque-Bera (JB): 81680638.75
Prob(Q): 1.00 Prob(JB): 0.00
Heteroskedasticity (H): 0.89 Skew: 7.35
Prob(H) (two-sided): 0.00 Kurtosis: 115.68
Warnings:
[1] Covariance matrix calculated using the outer product of gradients (complex-step).
** Model fit forecast(5, alpha=05) **
This give forecasts ok. Set fc, se, conf
fc, se, conf = model_fit.forecast(5, alpha=0.05)
Then run time error, too many variables, expected 3. Well, I applied fc, se, conf = model_fit.forecast() has prediction values.
ValueError Traceback (most recent call last)
<ipython-input-31-b0971fda8955> in <module>()
----> 1 fc, se, conf = model_fit.forecast(5, alpha=0.05)
2 results
ValueError: too many values to unpack (expected 3)
python
arima
forecast
0 Answers
Your Answer