# NOT RUN {
data(macrodata)
dep=macrodata[,1,drop=FALSE]
ind=macrodata[,-1,drop=FALSE]
timeframe=rollingWindows(dep,estimation="300m",by="6m")
FROM=timeframe$from
TO=timeframe$to
type=c("none","trend","season","both")[1]
models=c("rf","rpart","svm","knn","nnet")[4]
t0=1
# you may change this to "for (to in 1: length(TO))" to perform rolling CV
#output = ttsCaret(y=dep, x=ind, arOrder=c(1), xregOrder=c(1), method=models,
# tuneLength =10, train.end=as.character(TO[t0]), type=type)
#if(t0==length(TO)) {
# testData=window(output$dataused,start=TO[t0],end=end(Y))[-1,]
#} else {testData=window(output$dataused,start=TO[t0],end=TO[t0+1])[-1,]}
#P1=iForecast(Model=output,newdata=testData,type="staticfit") # static forecasts generated
#P2=iForecast(Model=output,newdata=testData,type="recursive") # dynamic forecasts generated
#tail(cbind(testData[,1],P1),10)
#tail(cbind(testData[,1],P2),10)
# }
Run the code above in your browser using DataLab