On 02.04.2010 23:37, JRsalvelinus wrote:

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])

We do not have the data, hence cannot reproduce your problem. I suspect you are storing the prcomp results in object chemPR1 but really running the predict() step on the ALSC1 object which does not only differ by name?

Uwe Ligges



Thanks.

Jason

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to