[BioC] how to use principal component analysis in R

James MacDonald jmacdon at med.umich.edu
Sun Jun 19 02:21:43 CEST 2005


Hi Weinong,

I would recommend using prcomp() for this. My general paradigm is as
follows:

pca <- prcomp(t(gene_matrix))
plot(pca$x[,1:2])

Notes:

1.) In general, matrices of gene data are usually samples in columns and
genes in rows, which is the transpose of what prcomp() expects, so you
have to use t().

2.) Usually when I plot the results, I also use pch, col, xlab, ylab,
main, etc. to make the plotting symbols for each group different shapes
and colors, add reasonable axis labels, a main title, etc. See ?par for
other variables you can pass to plot.

3.) It is nice to follow up with legend() to add a nice legend to the
plot. People seem to like that stuff ;-D.

4.) The general recommendation is to set scale. = TRUE in the call to
prcomp. I'm not sure if it will make much difference with microarray
data because it is usually normalized anyway, so I usually don't bother.
However, it is worth a try.

HTH,

Jim



James W. MacDonald
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623
>>> weinong han <hanweinong at yahoo.com> 06/18/05 2:10 AM >>>
Dear All,
 
Wish you have a nice weekend.
 
I want to run the two-dimensional principal-components analysis of
patient group using 174-gene signature  set  from Welch-T test to
separate the patient group, at the same time, I want to the plots of PCA
results.
 
Anyone tried or not? please tell me the functions and scripts.
 
Any advice and suggestions will be much appreciated.
 
Thanks in advance.


Best Regards
 
Han Weinong  
hanweinong at yahoo.com

		
---------------------------------

 Rekindle the Rivalries. Sign up for Fantasy Football
	[[alternative HTML version deleted]]

_______________________________________________
Bioconductor mailing list
Bioconductor at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/bioconductor



**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues.



More information about the Bioconductor mailing list