robjhyndman / forecast

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

Problem with auto.arima #784

Closed mbanco closed 5 years ago

mbanco commented 5 years ago

Hi, It seems to me that there is a problem when I use the forecast function, because the forecast it throws is inconsistent:

datos <- c(195604452.00, 160599506.00, 135322311.00, 154160556.00, 169070740.00, 168253197.00, 140658355.00, 137780852.00, 135403394.00, 168591150.00, 198584077.00, 227204286.00, 180556215.00, 165263511.00, 129456852.04, 144753813.64, 166643905.77, 176668161.35, 158053555.62, 141897394.36, 144800158.68, 167836612.34, 208804803.32, 201689210.16, 190075980.73, 167516319.57, 137313143.68, 142167781.18, 197590764.53, 192876711.00, 163662934.00, 133558120.00, 137391606.00, 157536647.00, 189444911.00);

y <- ts(datos, frequency = 12, start = c(2016, 2), class = 'ts');

t_arima <- auto.arima(y, xreg=NULL, stepwise=TRUE, lambda='auto');

forecast(t_arima, h=12, level=90)

Thanks!

mitchelloharawild commented 5 years ago

This issue is due to stats::arima() being dependent on scale (#756). The automatically selected value for lambda is very extreme, leading to values with very small scale changes (which are not handled well by stats::arima()).

Using a more appropriate transformation (or none at all) will work much better for this series. Automatic Box-Cox transformation selection should be used with caution.