Comparison of results from statsmodels ARIMA with original data
Asked Answered
C

1

3

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?

Carrera answered 7/5, 2015 at 17:36 Comment(3)
Have a look at the predict docstring and the typ keyword.Britten
Thanks. It looks kinda obvious now, but when I was reading the docs it was not that simple. Maybe a bit more of indication on the docs would help?Carrera
Also, it seems that this question already surfaced on the mailing list: groups.google.com/forum/?hl=en#!topic/pystatsmodels/QIhYf9XCyd8Carrera
C
4

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')
Carrera answered 11/5, 2015 at 17:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.