Question

I'm using tsDyn package to predict time series data in R. there is a function in this package called nnetTs. However when I try to predict, it just gives me 1 output and does not provide x steps ahead forecast. See eblow for the code:

library("tsDyn")
set.seed(1234)
mod.nnet <- nnetTs(log(lynx), m=2, size=3,steps=12)
mod.nnet
predict(mod.nnet,steps=12)

here is the output (as noted above, I'm just getting 1 single output and not 12 steps ahead prediction). I'm not sure what the issue is, I read the documentation, I'm stuck.

Time Series:
Start = 1935 
End = 1935 
Frequency = 1 
[1] 7.80263

Any help would be greatly appreicated

Was it helpful?

Solution

You should run

predict(mod.nnet,n.ahead=12)

at the last line. The argument for selecting forecast horizon is n.ahead not steps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top