cv.ts icon indicating copy to clipboard operation
cv.ts copied to clipboard

error on lmForecast

Open karlarao opened this issue 8 years ago • 0 comments

I was trying to re-create Rob's example here http://robjhyndman.com/hyndsight/tscvexample/ using cv.ts as you posted here http://1.bp.blogspot.com/-lkttbcc3SWI/Tsp_YFethQI/AAAAAAAACsY/frG55hOOZTE/s1600/hyndmanGraph.png on your blog http://moderntoolmaking.blogspot.com/2011/11/functional-and-parallel-time-series.html

But I'm having the following errors

# errors with 
# Error in data.frame(horizon = c(1:maxHorizon, "All"), out) : 
#   arguments imply differing number of rows: 13, 61 In addition: There were 50 or more warnings (use warnings() to see the first 50)

When I run

library(fpp)
x <- a10
myControl <- tseriesControl(maxHorizon=12)
lmForecast <- cv.ts(x, lmForecast, tsControl=myControl)

Also, I suppose you used the code here to reproduce Rob's graph (LM, ARIMA, ETS) https://gist.github.com/zachmayer/1383028

And I was also going through Rob's blog post. He showed the following examples: example1: add 1 on training set example2: fixed training window (training set always consists of k observations) example3: one step forecast in test example4: k-fold cross-validation (for large data sets)

the cv.ts code seems to be using #1 and #2

karlarao avatar Aug 27 '16 02:08 karlarao