问题
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