[R] vector length help using prcomp

JRsalvelinus jrsalvelinus at gmail.com
Fri Apr 2 23:37:11 CEST 2010


Hi

I am doing PCA using prcomp and when I try to get predicted values for the
different PC's the number of data points is always one less than in my
original data set.  This is a problem because it prevents me from doing any
post-hoc analysis due to the fact that my dependent variables are one entry
longer than my PC's.  I have checked for missing data to see if it is
omitting any but it is not.  It seems like it is always omitting the first
data point because the output for the predicted PC values always starts at 2
not 1.  Other than that the results of the analysis make sense and it
appears to be working correctly.

If anyone has any idea why this may be happening I would appreciate some
help.

This is the script I am using.

chemPR1 <- prcomp(~ ANC + color + CA + pH + TP + volume + maxdepth +
meandepth + elevation 
+ surface + shoreline + littoral , center = TRUE, scale=TRUE, scores=TRUE,
cor=TRUE)

PC1<-(predict(ALSC1)[,1])

Thanks.

Jason
-- 
View this message in context: http://n4.nabble.com/vector-length-help-using-prcomp-tp1749669p1749669.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list