how to use principal component analysis in R
2
0
Entering edit mode
weinong han ▴ 270
@weinong-han-1250
Last seen 10.2 years ago
An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/bioconductor/attachments/20050617/ 7bab7434/attachment.pl
• 3.1k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 3 days ago
United States
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.
ADD COMMENT
0
Entering edit mode
Aedin Culhane ▴ 310
@aedin-culhane-500
Last seen 10.2 years ago
Dear Weinong, We have provided a simple package for running PCA or correspondence analysis in the bioconductor package made4. It will accept most bioconductor data classes, a matrix or data.frame. To run a PCA library(made4) res<-ord(data, "pca") plot(res) This will give a plot of the eigenvalues, and the first two eigenvectors of the cases (arrays) and genes. Only the genes at the ends of the axes are labelled (to ease the visualisation). You can also use plotarrays(res) plotgenes(res) To visualise the genes and arrays. The package made4 required that ade4 is installed. If this is not, you can install it using install.packages("ade4") Regards Aedin >>> 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
ADD COMMENT

Login before adding your answer.

Traffic: 542 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6