It is not equal because you have asked from `prcomp' to standardize your data matrix,
try the following, pcprim$x==scale(iris)%*%pcprim$rotation Note also that the argument in `prcomp' is "scale." and not "scale" I hope this helps. Best, Dimitris ---- Dimitris Rizopoulos Doctoral Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/396887 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm ----- Original Message ----- From: "Scott Robbins Loarie" <[EMAIL PROTECTED]> To: "Prof Brian Ripley" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, June 14, 2004 9:35 AM Subject: [R] trouble with prcomp() > Thanks very much for showing me these functions, > > In prcomp(), the documentation says that Value: x is "the data > multiplied by the 'rotation' matix". Using sample data: > > data(iris) > iris<-as.matrix(iris[,1:4]) > pcprim<-prcomp(iris, scale=TRUE) > > Why does iris%*%pcprim$rotation (the data multiplied by the rotation > matrix) not equal pcprim$x? > > Thanks very much, > > Scott > > > On Mon, 14 Jun 2004, Prof Brian Ripley wrote: > > > Why are you using the OPRHANED multiv library for a facility covered by > > princomp() and prcomp() in base R? The list might be able to help you > > with the latter, but no one is supporting multiv (hence its status). > > > > On Sun, 13 Jun 2004, Scott Robbins Loarie wrote: > > > > > I am having trouble using the pca function in the multiv library. > > > I am trying to generate the values found in $rproj by using $evecs to > > > calculate linear combinations of my input data. However, I have been not > > > been able to correctly calculate the $rproj values. > > > > > > Using the following standard sample data, why does iris%*%pcprim$evecs[,] > > > not equal pcprim$rproj? > > > > > > data(iris) > > > iris<-as.matrix(iris[,1:4]) > > > pcprim<-pca(iris) > > > > -- > > Brian D. Ripley, [EMAIL PROTECTED] > > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > > University of Oxford, Tel: +44 1865 272861 (self) > > 1 South Parks Road, +44 1865 272866 (PA) > > Oxford OX1 3TG, UK Fax: +44 1865 272595 > > > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
