简体   繁体   中英

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)

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)"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM