1
$\begingroup$

After implementing random forest (with randomForest package in R) with satisfactory results, I'm trying now to make a rolling version that updates at a preset frequency. So far I tried with the following approaches :

  • use a 1 or 2 year rolling window to fit the random forest and predict over the following month
    • use a 1 or 2 year incremental window to fit the random forest and predict over the following month

Both approaches have been truly unsuccessful, as the results obtained have little to do with the results obtained from the static approach.

I'm considering to keep the traditional in sample - out of sample structure, using an exponential weighting to give more importance to current data, and keeping constant the percentage of the data in sample.

Any idea ? What else could work ? What is the best practice ?

Thank you

$\endgroup$
2
  • $\begingroup$ Is the question how to apply rf to time series data? $\endgroup$
    – Michael M
    Commented Oct 13, 2016 at 6:19
  • $\begingroup$ The question is how to apply random forest rolling, or in an online fashion. Yes, my question implies an application to time series. $\endgroup$
    – StatArb
    Commented Oct 13, 2016 at 6:31

1 Answer 1

1
$\begingroup$

Consider the size of the rolling window and the weighting scheme as hyperparameters for the model. Perform a grid search on different combinations and you'll find the answer. Basically, you have to find the balance between over-fitting for smaller windows/more aggressive weighting and bias due to "irrelevancy" of the sample for longer windows due to structural changes within. It depends on the stationarity of your time series data. In my practice, the longer the train window, the better OOS performance.

$\endgroup$
3
  • $\begingroup$ Hi nvicol, although I understand your reasoning, could you please write some sample code to better understand the procedure ? $\endgroup$
    – StatArb
    Commented Oct 14, 2016 at 7:23
  • $\begingroup$ Let's start from the toy code I already used in another post: getSymbols("GOOG") fit <- RF(lag(GOOG.Close,1), GOOG.Close, data=GOOG[1:(NROW(GOOG)-20)]) prediction <- predict(fit,GOOG[(NROW(GOOG)-19):NROW(GOOG)]) How would you implement the grid search ? Thank you $\endgroup$
    – StatArb
    Commented Oct 14, 2016 at 7:26
  • $\begingroup$ I'm sorry for the mess in the comment but when I press Enter the comment is posted. $\endgroup$
    – StatArb
    Commented Oct 14, 2016 at 7:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.