Question: PCA-prcomp() versus plotPCA
0
gravatar for marco fabbri
13.1 years ago by
marco fabbri320
Italy
marco fabbri320 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? 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 • 2.3k views
ADD COMMENTlink modified 13.1 years ago by James W. MacDonald52k • written 13.1 years ago by marco fabbri320
Answer: PCA-prcomp() versus plotPCA
0
gravatar for James W. MacDonald
13.1 years ago by
United States
James W. MacDonald52k 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.
ADD COMMENTlink written 13.1 years ago by James W. MacDonald52k
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 REPLYlink written 13.1 years ago by marco fabbri320
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 REPLYlink written 13.1 years ago by James W. MacDonald52k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 181 users visited in the last hour