robjhyndman / forecast

Forecasting Functions for Time Series and Linear Models
http://pkg.robjhyndman.com/forecast
1.12k stars 342 forks source link

auto.arima not finding the best model #800

Closed robjhyndman closed 5 years ago

robjhyndman commented 5 years ago
auto.arima(fma::condmilk, stepwise = FALSE, approximation = FALSE)
#> Series: fma::condmilk 
#> ARIMA(1,0,0)(0,1,2)[12] 
#> 
#> Coefficients:
#>          ar1     sma1    sma2
#>       0.7767  -0.9174  0.0531
#> s.e.  0.0627   0.1493  0.1282
#> 
#> sigma^2 estimated as 127.1:  log likelihood=-422.08
#> AIC=852.15   AICc=852.54   BIC=862.88
Arima(fma::condmilk, order=c(1,0,0), seasonal=c(0,1,1))
#> Series: fma::condmilk 
#> ARIMA(1,0,0)(0,1,1)[12] 
#> 
#> Coefficients:
#>          ar1     sma1
#>       0.7800  -0.9162
#> s.e.  0.0618   0.2330
#> 
#> sigma^2 estimated as 122.6:  log likelihood=-422.16
#> AIC=850.31   AICc=850.55   BIC=858.36

Created on 2019-05-15 by the reprex package (v0.2.1)

mitchelloharawild commented 5 years ago

The roots of the 'best' model are too close to the boundary, giving an infinite ic in the auto.arima model selection procedure.

library(forecast)
fit <- auto.arima(fma::condmilk, stepwise = FALSE, approximation = FALSE)
fit %>% autoplot()

min(abs(forecast:::arroots(fit)$roots))
#> [1] 1.287523
min(abs(forecast:::maroots(fit)$roots)) # Only just passes the >1.01 threshold
#> [1] 1.013105

fit <- Arima(fma::condmilk, order=c(1,0,0), seasonal=c(0,1,1)) 
fit %>% autoplot()

min(abs(forecast:::arroots(fit)$roots))
#> [1] 1.282132
min(abs(forecast:::maroots(fit)$roots)) # Fails the >1.01 threshold
#> [1] 1.00732

Created on 2019-05-15 by the reprex package (v0.2.1)