createTimeSlices function in CARET package in R

Panchacookie picture Panchacookie · Mar 11, 2014 · Viewed 9.4k times · Source

I am working with multivariate financial time series data and having problems using the createTimeSlices function. I cannot find any use of the function except the one used by Max Kuhn. Can anybody help me in understanding the usage of the function?

Answer

topepo picture topepo · Mar 11, 2014

The documentation is being "improved" on this feature (in other words, it currently sucks). Another person contacted me recently about this and here is the example:

library(caret)
library(ggplot2)
data(economics)
myTimeControl <- trainControl(method = "timeslice",
                              initialWindow = 36,
                              horizon = 12,
                              fixedWindow = TRUE)

plsFitTime <- train(unemploy ~ pce + pop + psavert,
                    data = economics,
                    method = "pls",
                    preProc = c("center", "scale"),
                    trControl = myTimeControl)

Max