[R] t() prior to data rotation

Carl Witthoft carl at witthoft.com
Sat Aug 20 18:45:26 CEST 2011


Well, did you try it with a simple test case to see what comes out?
Do you have a sample "mydata.txt" file so you know how it's ordered in 
the first place?

Carl

<quote>
From: christopher stratton <cfstratton_at_gmail.com>
Date: Fri, 19 Aug 2011 23:10:07 -0400

Dear All,

I have come upon an R-mode PCA protocol that uses the following 
arguments, where "mydata.txt" is an nxm matrix of n objects and m variables:

 > a <- read.table("mydata.txt")
 > b <- t(a)
 > c <- prcomp(b)
 > c$rotation
The user then plots the coordinates given by c$rotation (PC1 and PC2) as 
the "scores" of their PCA plot.

This doesn't make sense to me as the user transposed the matrix prior to 
rotating the data, so they have solved for the eigenvectors of the 
objects and by plotting the values of c$rotation the user is in effect 
plotting the loading matrix and not the scores. If anything, this looks 
like a Q-mode PCA where the rotation matrix should be multiplied by the 
original data matrix to give scores for the variables.

Am I missing something or does this procedure look incorrect?

Thank you for your time,
Chris
</quote>
-- 
-----
Sent from my Cray XK6



More information about the R-help mailing list