Comparison of results from statsmodels ARIMA with original data

穿精又带淫゛_ 提交于 2019-12-14 01:47:38

问题


I have a time series with seasonal components. I fitted the statsmodels ARIMA with

model = tsa.arima_model.ARIMA(data, (8,1,0)).fit()

For example. Now, I understand that ARIMA differences my data. How can I compare the results from

prediction = model.predict()
fig, ax = plt.subplots()
data.plot()
prediction.plot()

as data will be the original data and prediction is differenced, and so has a mean around 0, different from the mean of data?


回答1:


As the documentation shows, if the keyword typ is passed to the predict method, the answer can be show in the original predictor variables:

typ : str {‘linear’, ‘levels’}

    ‘linear’ : Linear prediction in terms of the differenced endogenous variables.
    ‘levels’ : Predict the levels of the original endogenous variables.

So the call would be

model = tsa.arima_model.ARIMA(data, (12,1,0)).fit()
arima_predict = model.predict('2015-01-01','2016-01-01', typ='levels')


来源:https://stackoverflow.com/questions/30108091/comparison-of-results-from-statsmodels-arima-with-original-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!