Displaying 1 result from an estimated 1 matches for "xlast".
Did you mean:
last
2012 Aug 27
0
How can I find the principal components and run regression/forecasting using dynlm
...model<-dynlm(as.ts(y[(h+1):t]) ~ L(as.ts(X[1:(t-h)]), 0:i) +
L(as.ts(z[1:(t-h)]),0:j)) # y, X, z are a zoo objects defined earlier; i
and j, t, h are given 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...