user7892705
user7892705

Reputation: 147

How to extract the name of the model fit using auto.arima() function in the forecast package?

I want to extract the name of the model fit by auto.arima() in the forecast package.

For example, if I run the following code,

library(forecast)
auto.arima(WWWusage)

I get the output as follow:

Series: WWWusage 
ARIMA(1,1,1)                    

Coefficients:
         ar1     ma1
      0.6504  0.5256
s.e.  0.0842  0.0896

sigma^2 estimated as 9.995:  log likelihood=-254.15
AIC=514.3   AICc=514.55   BIC=522.08

I want to know how to extract the name of the model only, which is in this case ARIMA(1,1,1)

Upvotes: 3

Views: 1045

Answers (1)

MrFlick
MrFlick

Reputation: 206253

The as.character() function has been overloaded in the package to return the value you are interested in.

fit <- auto.arima(WWWusage)
as.character(fit)
# [1] "ARIMA(1,1,1)"

Upvotes: 4

Related Questions