1
$\begingroup$

Dear forecast scientists,

I'm using the R 'Forecast' package to generate batch forecasts. I have a question regarding some of the great auto-fit techniques offered by this package (E.g., auto.arima,ar,tbats,ets).

The proposed workflow is as follows:

Step 1: Define hold-out period (test data, basically) and then push the training set to R for forecasting. Run different auto-fit techniques in R, and figure out which method gives the least error (e.g., based on RMSE)

Step 2: In the second iteration, I am wondering if I can pass the data again (this time with ALL time series observations) while using the best fit model (established in Step 1) to generate the forward forecast.

For carrying out Step 2, I am not sure of how to isolate the parameters used by the auto-fit techniques. As someone with a cursory exposure to forecast concepts (primarily self taught so far), it would be great if there is an easy means to obtain this information and pass it back. (E.g., AR-> AR, Auto.ARIMA-> ARIMA)

I am afraid if I run Step 2 and invoke an auto-fit command again, it can possibly worsen the over fitting problem by choosing an all-together different model, which will be in conflict with the purpose of Step 1.

Please consider the following sample code for an Auto-Regression Run for sample SKU:

    ###Time Series          
    wseries<c(241,260,247,211,275,334,222,360,262,419,371,422,475,405,426,320,421,347,344,551,436,481,512,378,428,542,487,482,600,538,669,478,666,559,610,581)

    ###Training Data

         wseriests <- ts(wseries[1:32],frequency=12)

    ###Test Data (Setting 4 M hold-out period)

         wsacc<-wseries[33:36]

    ###Auto-Regression Run

         forecastobj <- ar(wseriests, aic = TRUE)

    ###4-Period Forward Forecast and Out-of-Sample-Accuracy Calculation

         predobj <- forecast.ar(forecastobj , h=4)

         werroraccuracy<-accuracy(predobj,wsacc)

    ###5-Which model has Auto-Regression chosen? Which parameters and 
    corresponding values do I pass back to the ar model for my second 
    iteration?

         forecastobj$order
         [1] 2  

         forecastobj$ar
         [1] 0.3965009 0.3598146

         forecastobj$call
         [1] ar(x = wseriests, aic = TRUE)

Best regards,

Suraj

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.