robjhyndman / forecast

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

tsCV does not retrains model through forecast function #711

Closed alexcombessie closed 6 years ago

alexcombessie commented 6 years ago

I am comparing the results from different versions:

# ARIMA_MODEL is an auto.arima that has been trained on time series TS_OUTPUT

# version 1
arima_forecast1 <- function(x, h){forecast(x, h = h, model = ARIMA_MODEL)}
e1 <- tsCV(TS_OUTPUT, arima_forecast1, h=2)

# version 2
arima_forecast2 <- function(x, h){forecast(auto.arima(x, trace = TRUE), h = h)}
e2 <- tsCV(TS_OUTPUT, arima_forecast2, h=2)

e1 and e2 are different. Does it mean that when passing a pretrained model argument to the forecast function, the model is not re-estimated?

If so, which version should I use? My goal is to compare several model types on the same dataset in the most robust way possible. Do you confirm that version 2 answers to this goal?

Thanks a lot!

robjhyndman commented 6 years ago

tsCV simply runs the function you pass to it. It's up to you whether you want to re-estimate the model or not.

Please ask for help at crossvalidated.com or stackoverflow.com. This form is for bug reports.