Skip to content

Error in princomp?

3 messages · Peter Vikström, Thomas Lumley, Marc Feldesman

#
Hello!

When using princomp() for principal components analysis, the resulting
loadings matrix differs between R and the output from other programs (S-plus
and SAS)
The difference is that the sign of some columns in the loadings matrix. The
absolute values, however, are the same.
This sign difference also exists when comparing the princomp() results with
the manually calculated eigen vectors using eigen().
Is this a bug in R?
I am using R ver 1.5.1

Thanks in advance,
Peter

===========================================
Peter Vikstr?m
Dept. of Economic History
Ume? University
SE-901 87  UME?

E-mail: peter.vikstrom at ekhist.umu.se
===========================================

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Thu, 3 Oct 2002, [iso-8859-1] Peter Vikström wrote:

            
No. The results are only defined up to a sign change.

	-thomas


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Thu, 3 Oct 2002 22:19:48 +0200, an incredible array of electrons randomly cascading around the Universe collided and turned into words spewed forth by Peter Vikstr?m:


Peter> Hello!
Peter> 
Peter> When using princomp() for principal components analysis, the resulting
Peter> loadings matrix differs between R and the output from other programs (S-plus
Peter> and SAS)
Peter> The difference is that the sign of some columns in the loadings matrix. The
Peter> absolute values, however, are the same.
Peter> This sign difference also exists when comparing the princomp() results with
Peter> the manually calculated eigen vectors using eigen().
Peter> Is this a bug in R?
Peter> I am using R ver 1.5.1

Signs of principal components are arbitrary.  It isn't uncommon at all to have two programs give the same absolute value pc's but differ in sign.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._