Ivan
Ivan

Reputation: 20101

Comparison of results from statsmodels ARIMA with original data

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?

Upvotes: 3

Views: 2713

Answers (1)

Ivan
Ivan

Reputation: 20101

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')

Upvotes: 4

Related Questions