Displaying 2 results from an estimated 2 matches for "mpca".
Did you mean:
mca
2012 Aug 23
1
Accessing the (first or more) principal component with princomp or prcomp
...lysis, princomp and prcomp.
I don't really know the difference; the only thing I know is that when
the sample size < number of variable, only prcomp will work. Could someone
tell me the difference or where I can find easy-to-read reference?
To access the first PC using princomp:
Mpca<-princomp(M, cor=T)
Mpca$scores[,1]
How can I access the first PC using prcomp?
Mpca<-prcomp(M)
Is there an option for "cor=T"?
In case where both functions work, will the results be the same?
Thanks,
Miao
[[alternative HTML version deleted]]
2012 Aug 27
0
How can I find the principal components and run regression/forecasting using dynlm
...than vector as explanatory variables (2)I don't know how to do a
forecast with the estimation results of dynlm properly. In lm model,
function "predict.lm" can do it.
For the case of first principal component (In order to accentuate the
main problem, I have simplify the codes):
Mpca<-prcomp(M1, center=TRUE, scale =TRUE) # M1 is the data matrix of
explanatory variables
Mpca1st<-Mpca$x[,1] # first principle component
X<-as.matrix(Mpca1st)
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 def...