I have been training ARIMA models using the statsmodels (v0.12.2) package, and would like to check out how a model fits on the training data
Current Code:
from statsmodels.tsa.arima.model import ARIMA
#for some p,d,q
model = ARIMA(train, order = (p,d,q)
model_fit = model.fit()
Attempting to do:
I would like to plot the predictions of the training set against the actual training values.
I have been trying to use the following after reading this documentation:
model_fit.get_prediction()
However, this returns:
<statsmodels.tsa.statespace.mlemodel.PredictionResultsWrapper at 0x7f804bf5bbe0>
Question:
How can I return these predicted values for the training set?
Advice appreciated!
CodePudding user response:
I think you are looking for the fitted values of the model, if so then use,
model_fit.fittedvalues
You can find a complete example here.
CodePudding user response:
I've found that changing:
model_fit.get_prediction()
to
model_fit.get_prediction().predicted_mean
returns an array which isnt perfect but suitable for my analysis.
Please post an answer if you have an alternative/better method!