search for: pi1fore

Displaying 1 result from an estimated 1 matches for "pi1fore".

2012 Aug 27
0
How can I find the principal components and run regression/forecasting using dynlm
...n earlier; h is the forecasting horizon; since dynlm can't work for zoo object, the variables need to be transformed to ts objects. Xlast<-as.matrix(X[(t-h):(t-h-i+1)]) zlast<-t(as.matrix(z[(t-h):(t-h-j+1)])) # Make it a column matrix beta<-as.matrix(model$coefficient) pi1fore[t]<-pi1[t-h]+c(1, Xlast, zIlast)%*%beta # pi1fore is defined earlier . I just use the inner product as a vehicle for forecasting. I don't know if there's a way that the codes can be written neatly? return(pi1fore) Then I attempt to program similarly for the multi-factor case:...