1

I am working on time series models. I got to use auto_arima model in pyramid-arima module. I have fitted a auto_arima model on my data set. Now I have two questions.

  1. I would like to see the model parameters.

  2. I would like to get fitted values from the model.

Below one is my sample code.

m1_hist = auto_arima(ts1_hist, start_p=1, start_q=1,
                       max_p=3, max_q=3, m=12,
                       start_P=0, seasonal=True,
                       d=1, D=1, trace=True,
                       error_action='ignore',  
                       suppress_warnings=True, 
                       stepwise=True)

m1_hist2 = m1_hist.fit(ts1_hist)

I used m1_hist.params to get the model parameters. But it is not showing me the outputs.

Can you please address my questions?

Thanks in advance.

RSK
  • 751
  • 2
  • 7
  • 18

2 Answers2

2

Actually you should be using

m1_hist.arparams()
# output: array([-0.06322811,  0.26664419]) in my case

or

m1_hist.params()
# array([-3.53003470e-03, -6.32281127e-02,  2.66644193e-01, -3.67248974e-01,-5.76907932e-01,  5.83541332e-01, -2.66632875e-01, -1.28657280e+00,  4.93685722e-01,  5.05488473e+00])
Chandu
  • 2,053
  • 3
  • 25
  • 39
0

After you find the model, you should fit it on your actual (y) values. Predictions of the y values based on selected model in arima will be fitted values.

For example,

start_index = 0 
end_index = 15
forecast_index = 15
y = df.iloc[start_index:end_index] # end index in iloc is exclusive
model = auto_arima(y, ....)

# Predictions of y values based on "model", namely fitted values
yhat = model_fit.predict_in_sample(start=start_ind, end=end_ind - 1)

# One step forecast: forecast the element at index 15 
forecast = model_fit.predict(n_periods=1)
isabella
  • 467
  • 3
  • 11