[R] R: forecasting a binary time series using the VLMC package
Gauthier Pierard
gpierard86 at gmail.com
Tue Aug 18 10:37:03 CEST 2015
I would like to ask some clarifications on the method:
predict.vlmc
My problem is to forecast a binary time series one period ahead. I have a
time series bin2 of length 2000. When using
m2<-vlmc(bin2)
fc2<-predict(m2)
1. fc2[i] is a prediction for i, not for i+1, is that correct? I am
aware that the documentation stipulates "Compute predictions on a fitted
VLMC object for each (but the first) element of another discrete time
series.", but am still asking to make it 100% clear.
2.
I guess that the predictions fc2 are based on the full range [1:2000] of
bin2, because I fitted a VLMC to the full timeseries on the first line
above. Therefore, I am actually forecasting each period by already "knowing
the future", is that correct?
3.
In order to forecast while "not knowing the future", can I do the
following:
for(i in 1000:1999) {
retFull2 <- window(retFull, start=1, end=i)
bin2<- window(bin, start=1, end=i)
dummy<-ts(c(bin2,0)) #Adding a dummy zero at the end of each window
#so that a prediction will be made for i+1 as well
#without using i+1 while fitting the model
m2<-vlmc(bin2) # bin2 granges from 1 to i
fct2<-predict(m2, dummy)[i+1,1] #forecasting on an "
artificially-added" i+1 index.}
I am adding a "dummy" zero at the end of each windowed ts, and
predicting for i+1 as well. Is it relevant at all? Any suggestions? Any
practical suggestions on how to best forecast these binary time series?
Many thanks in advance, cheers!!!!!!!!
[[alternative HTML version deleted]]
More information about the R-help
mailing list