Evy555
Evy555

Reputation: 229

How to print AIC or BIC from ARIMA Model

I've created an ARIMA model, but I am unable to find a way to print the AIC or BIC results. I need these numbers for model comparison. Unfortunately the documentation on sourceforge is down, and I cannot find my answer when looking at the statsmodel github repository.

Here's my code:

import pandas as pd
import pandas.io.data
import statsmodels.formula.api as sm 
import matplotlib.pyplot as plt 
from statsmodels.tsa.arima_model import ARIMA

list = ['spy']
df = pd.io.data.get_data_yahoo(list, start = '2013-11-01', end = '2016-7-01', interval = 'm')['Adj Close'] 
df.dropna(inplace = True) 
df = df.pct_change()
df.dropna(inplace = True) 

model = ARIMA(df.spy, order = (0,0,1))
results_ARIMA = model.fit(disp=-1)
plt.plot(results_ARIMA.fittedvalues, color='red') 
plt.show() 

Upvotes: 0

Views: 11308

Answers (2)

Edward Hong
Edward Hong

Reputation: 11

results_ARIMA.aic and results_ARIMA.bic will give you the corresponding values. You don't need the brackets since these are not callable.

Upvotes: 1

Evy555
Evy555

Reputation: 229

I figured out the solution here. You need to import the ARMAResults class from statsmodels.tsa.arima_model.

from statsmodels.tsa.arima_model import ARMAResults 

Once this is complete you can insert

print(ARMAResults.summary(results_ARIMA))

This will print out the results summary which includes the BIC and AIC.

Upvotes: 1

Related Questions