PCA-prcomp() versus plotPCA
1
0
Entering edit mode
marco fabbri ▴ 320
@marco-fabbri-1657
Last seen 7.5 years ago
Italy
Two question on PCA: 1. I like plotPCA from affycoretools package, but I was not able to plot the third component. Am I wrong? 2.I try the prcomp() function and I compared it to plotPCA. TesetA=t(exprs(esetA)) pca=prcomp(TAM, retx=TRUE,center=TRUE, scale= TRUE) plot(pca$x[,1:2]) -------- plotPCA(esetA,groups=c(1:10)) I had different plots. Can please help me to understand better what plotPCA is doing? Thank you MArco -- --------------------------------------- Marco Fabbri Istituto Clinico Humanitas via Manzoni, 52 20089 Rozzano (Mi) Tel. 028224 5152 Fax 028224 5101
affycoretools affycoretools • 4.0k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 13 hours ago
United States
Hi Marco, marco fabbri wrote: > Two question on PCA: > > 1. I like plotPCA from affycoretools package, but I was not able to > plot the third component. > Am I wrong? No you are not wrong. By default plotPCA() only does the first two principal components. If there is interest I could easily add the capability to do the first three PCs and plot using scatterplot3D. > > 2.I try the prcomp() function and I compared it to plotPCA. > > TesetA=t(exprs(esetA)) > pca=prcomp(TAM, retx=TRUE,center=TRUE, scale= TRUE) > plot(pca$x[,1:2]) > -------- > plotPCA(esetA,groups=c(1:10)) > > I had different plots. > Can please help me to understand better what plotPCA is doing? plotPCA() is using the default arguments to prcomp(), which includes scale.=FALSE. Usually one wants to scale data prior to performing the PCA if the data are on different scales. However, most Affy data are normalized which should put the data on similar scales, so I just stick with the default. HTH, Jim > > > Thank you > MArco > -- James W. MacDonald, M.S. Biostatistician Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 ********************************************************** 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
Hi James, thank you for the quick reply. More than plot all the three PCs, I would like to decide which two to plot, for example to plot PC2 versus PC3. If you are implementing please let me know I will use for sure. Marco On 14/11/06, James W. MacDonald <jmacdon at="" med.umich.edu=""> wrote: > Hi Marco, > > marco fabbri wrote: > > Two question on PCA: > > > > 1. I like plotPCA from affycoretools package, but I was not able to > > plot the third component. > > Am I wrong? > > No you are not wrong. By default plotPCA() only does the first two > principal components. If there is interest I could easily add the > capability to do the first three PCs and plot using scatterplot3D. > > > > > 2.I try the prcomp() function and I compared it to plotPCA. > > > > TesetA=t(exprs(esetA)) > > pca=prcomp(TAM, retx=TRUE,center=TRUE, scale= TRUE) > > plot(pca$x[,1:2]) > > -------- > > plotPCA(esetA,groups=c(1:10)) > > > > I had different plots. > > Can please help me to understand better what plotPCA is doing? > > plotPCA() is using the default arguments to prcomp(), which includes > scale.=FALSE. Usually one wants to scale data prior to performing the > PCA if the data are on different scales. However, most Affy data are > normalized which should put the data on similar scales, so I just stick > with the default. > > > HTH, > > Jim > > > > > > > > Thank you > > MArco > > > > > -- > James W. MacDonald, M.S. > Biostatistician > Affymetrix and cDNA Microarray Core > University of Michigan Cancer Center > 1500 E. Medical Center Drive > 7410 CCGC > Ann Arbor MI 48109 > 734-647-5623 > > > ********************************************************** > Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues. > -- --------------------------------------- Marco Fabbri Istituto Clinico Humanitas via Manzoni, 52 20089 Rozzano (Mi) Tel. 028224 5152 Fax 028224 5101
ADD REPLY
0
Entering edit mode
Hi Marco, That sounds reasonable. I will add this functionality to the devel version of affycoretools, probably this week. You don't mention your OS, but if you are on Windows I might need to send you a binary, as the binary affycoretools tends not to get built until close to release time (because it depends on biomaRt, which depends on RCurl, which takes a bit of work to build on windows...). Best, Jim marco fabbri wrote: > Hi James, > thank you for the quick reply. > More than plot all the three PCs, I would like to decide which two to > plot, for example to plot PC2 versus PC3. > If you are implementing please let me know I will use for sure. > > Marco > > On 14/11/06, James W. MacDonald <jmacdon at="" med.umich.edu=""> wrote: > >> Hi Marco, >> >> marco fabbri wrote: >> > Two question on PCA: >> > >> > 1. I like plotPCA from affycoretools package, but I was not able to >> > plot the third component. >> > Am I wrong? >> >> No you are not wrong. By default plotPCA() only does the first two >> principal components. If there is interest I could easily add the >> capability to do the first three PCs and plot using scatterplot3D. >> >> > >> > 2.I try the prcomp() function and I compared it to plotPCA. >> > >> > TesetA=t(exprs(esetA)) >> > pca=prcomp(TAM, retx=TRUE,center=TRUE, scale= TRUE) >> > plot(pca$x[,1:2]) >> > -------- >> > plotPCA(esetA,groups=c(1:10)) >> > >> > I had different plots. >> > Can please help me to understand better what plotPCA is doing? >> >> plotPCA() is using the default arguments to prcomp(), which includes >> scale.=FALSE. Usually one wants to scale data prior to performing the >> PCA if the data are on different scales. However, most Affy data are >> normalized which should put the data on similar scales, so I just stick >> with the default. >> >> >> HTH, >> >> Jim >> >> >> > >> > >> > Thank you >> > MArco >> > >> >> >> -- >> James W. MacDonald, M.S. >> Biostatistician >> Affymetrix and cDNA Microarray Core >> University of Michigan Cancer Center >> 1500 E. Medical Center Drive >> 7410 CCGC >> Ann Arbor MI 48109 >> 734-647-5623 >> >> >> ********************************************************** >> Electronic Mail is not secure, may not be read every day, and should >> not be used for urgent or sensitive issues. >> > > -- James W. MacDonald, M.S. Biostatistician Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 ********************************************************** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues.
ADD REPLY

Login before adding your answer.

Traffic: 820 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