robjhyndman / forecast

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

cryptic auto.arima error when unexpected arguments passed to `...` #446

Closed davharris closed 7 years ago

davharris commented 7 years ago

I ran into this problem when I typed something like

library(forecast)
x = c(49L, 49L, 65L, 54L, 54L, 58L, 65L, 55L, 54L, 57L, 61L, 57L, 
      52L, 55L, 62L, 57L, 56L, 53L, 58L, 63L)
forecast::auto.arima(x, level = 0.95)

which throws this error:

Error in forecast::auto.arima(x, level = 0.95) : 
  No suitable ARIMA model found

I haven't dug into this carefully, but it looks like the problem might live in myarima:

My theory is that stats::arima throws an unused argument error, which is caught with try. The unused argument error never gets passed to the user, who only sees a generic "no suitable model" error.

If this is the case, it seems like auto.arima could give much more informative error messages simply by passing along any exceptions from stats::arima.

robjhyndman commented 7 years ago

Fixed in https://github.com/robjhyndman/forecast/commit/1901dd1c3b93df1dc0cc3eb91394dbb824e58b2d