Yes. I know for certain that "mydata.txt" is ordered as an nxm matrix with n
objects and m variables.

Being that the data is transposed prior to performing the PCA, the rotation
matrix ends up being given in terms of object loadings on the principal
components, rather than variables as it's normally done.

I tried a sample data set and if you plot the values of b$rotation from the
transposed data, you end up with a similar (but, not equivalent) plot as if
you processed the data without transposing it first, i.e.,:

> a <- read.table("mydata.txt")
> b <- prcomp(a, retx = TRUE)
> b$x

Even though the results are similar, conceptually I am not sure why it's
okay to transpose the data, perform PCA, and then plot the rotation matrix
as though they were scores.

Thanks again,
Chris

On Sat, Aug 20, 2011 at 12:45 PM, Carl Witthoft <carl@witthoft.com> wrote:

> 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
>
> ______________________________**________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help>
> PLEASE do read the posting guide http://www.R-project.org/**
> posting-guide.html <http://www.R-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Christopher F. Stratton
Tan Laboratory
Memorial Sloan–Kettering Cancer Center
1275 York Ave., Box 422, ZRC-2131, New York, NY 10065
Tel: 646-888-2229  -  Fax: 646-422-0416

	[[alternative HTML version deleted]]

