Displaying 1 result from an estimated 1 matches for "mpca1f".
Did you mean:
mpc51
2012 Aug 27
0
How can I find the principal components and run regression/forecasting using dynlm
...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:
Mpca<-prcomp(M1, center=TRUE, scale =TRUE) # M1 is the data matrix of
explanatory variables
Mpca1f<-Mpca$x[,(1:f)] # first f principle components
X<-as.matrix(Mpca1f)
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)) # Since X has more than one column, I add a
comma after 1:(t-h). I don't know if I am right here?
Xlast<-as.matr...