Skip to content

quantmod and forecast

2 messages · Eric Thungstom, Brian G. Peterson

#
On 06/24/2012 10:20 PM, Eric Thungstom wrote:
From the documentation for ?accuracy :

     test: Indicator of which elements of x and f to test. If
           ?test=="all"?, all elements are used. Otherwise test is a
           numeric vector containing the indices of the elements to use
           in the test.

your 'test' is an xts object, the entire time series, not a numeric 
vector of indices.

Also, since your dates don't line up, this can never work.

rwf makes a number of forecasts specified by 'h'.  You only make one, 
for Feb 2009.

Try summary(train.model), and try some more documentation reading and 
examples.  From here, it looks like everything is fine so far.

GSPC.model <-rwf(z, drift=TRUE,h=20)
summary(GSPC.model)