ian_zhangty
2011-Mar-16 14:18 UTC
[R] How to read "Cumulative proportion" in using princomp?
Dear all,> result<-summary(princomp(x,cor=TRUE)) >resultImportance of components: Comp.1 Comp.2 Comp.3 Comp.4 Standard deviation 1.642136 1.0114376 0.45146892 0.27669119 Proportion of Variance 0.674153 0.2557515 0.05095605 0.01913950 Cumulative Proportion 0.674153 0.9299044 0.98086050 1.00000000 I want to read Cumlative Proportion listed above. But I cannot find it in result, instead, R gives me followed, which is not same with above:>result[2]$loadings Loadings: Comp.1 Comp.2 Comp.3 Comp.4 YC.T 0.183 0.935 0.250 0.172 YC.Rad 0.581 -0.130 -0.413 0.689 YC.Rain -0.537 0.308 -0.784 YC.ETPM 0.583 0.119 -0.389 -0.703 Comp.1 Comp.2 Comp.3 Comp.4 SS loadings 1.00 1.00 1.00 1.00 Proportion Var 0.25 0.25 0.25 0.25 Cumulative Var 0.25 0.50 0.75 1.00 I am wondering how can I calculate "Cumulative Proportion" in the first result. Thank you very much -- View this message in context: http://r.789695.n4.nabble.com/How-to-read-Cumulative-proportion-in-using-princomp-tp3381881p3381881.html Sent from the R help mailing list archive at Nabble.com.
Martyn Byng
2011-Mar-16 17:31 UTC
[R] How to read "Cumulative proportion" in using princomp?
Hi, The values are calculated on the fly in the summary function stats:::print.summary.princomp using vars <- result$sdev^2 vars <- vars/sum(vars) cumsum(vars) Martyn -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of ian_zhangty Sent: 16 March 2011 14:19 To: r-help at r-project.org Subject: [R] How to read "Cumulative proportion" in using princomp? Dear all,> result<-summary(princomp(x,cor=TRUE)) >resultImportance of components: Comp.1 Comp.2 Comp.3 Comp.4 Standard deviation 1.642136 1.0114376 0.45146892 0.27669119 Proportion of Variance 0.674153 0.2557515 0.05095605 0.01913950 Cumulative Proportion 0.674153 0.9299044 0.98086050 1.00000000 I want to read Cumlative Proportion listed above. But I cannot find it in result, instead, R gives me followed, which is not same with above:>result[2]$loadings Loadings: Comp.1 Comp.2 Comp.3 Comp.4 YC.T 0.183 0.935 0.250 0.172 YC.Rad 0.581 -0.130 -0.413 0.689 YC.Rain -0.537 0.308 -0.784 YC.ETPM 0.583 0.119 -0.389 -0.703 Comp.1 Comp.2 Comp.3 Comp.4 SS loadings 1.00 1.00 1.00 1.00 Proportion Var 0.25 0.25 0.25 0.25 Cumulative Var 0.25 0.50 0.75 1.00 I am wondering how can I calculate "Cumulative Proportion" in the first result. Thank you very much -- View this message in context: http://r.789695.n4.nabble.com/How-to-read-Cumulative-proportion-in-using -princomp-tp3381881p3381881.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ________________________________________________________________________ This e-mail has been scanned for all viruses by Star.\ _...{{dropped:12}}
Peter Ehlers
2011-Mar-16 17:38 UTC
[R] How to read "Cumulative proportion" in using princomp?
On 2011-03-16 10:31, Martyn Byng wrote:> Hi, > > The values are calculated on the fly in the summary function > > stats:::print.summary.princomp > > using > > vars<- result$sdev^2 > vars<- vars/sum(vars) > cumsum(vars) >Or you could use the prcomp summary function (maybe you should use prcomp() for you model?): stats:::summary.prcomp(result)$importance[3, ] Use str() to inspect the components of the summary function. Peter Ehlers> > Martyn > > -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] > On Behalf Of ian_zhangty > Sent: 16 March 2011 14:19 > To: r-help at r-project.org > Subject: [R] How to read "Cumulative proportion" in using princomp? > > Dear all, > >> result<-summary(princomp(x,cor=TRUE)) >> result > Importance of components: > Comp.1 Comp.2 Comp.3 Comp.4 > Standard deviation 1.642136 1.0114376 0.45146892 0.27669119 > Proportion of Variance 0.674153 0.2557515 0.05095605 0.01913950 > Cumulative Proportion 0.674153 0.9299044 0.98086050 1.00000000 > > I want to read Cumlative Proportion listed above. But I cannot find it > in > result, instead, R gives me followed, which is not same with above: >> result[2] > $loadings > > Loadings: > Comp.1 Comp.2 Comp.3 Comp.4 > YC.T 0.183 0.935 0.250 0.172 > YC.Rad 0.581 -0.130 -0.413 0.689 > YC.Rain -0.537 0.308 -0.784 > YC.ETPM 0.583 0.119 -0.389 -0.703 > > Comp.1 Comp.2 Comp.3 Comp.4 > SS loadings 1.00 1.00 1.00 1.00 > Proportion Var 0.25 0.25 0.25 0.25 > Cumulative Var 0.25 0.50 0.75 1.00 > > I am wondering how can I calculate "Cumulative Proportion" in the first > result. > Thank you very much > > -- > View this message in context: > http://r.789695.n4.nabble.com/How-to-read-Cumulative-proportion-in-using > -princomp-tp3381881p3381881.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > ________________________________________________________________________ > This e-mail has been scanned for all viruses by Star.\ _...{{dropped:12}} > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
ian_zhangty
2011-Mar-17 00:10 UTC
[R] How to read "Cumulative proportion" in using princomp?
THANK U VERY MUCH!!!!!! -- View this message in context: http://r.789695.n4.nabble.com/How-to-read-Cumulative-proportion-in-using-princomp-tp3381881p3383396.html Sent from the R help mailing list archive at Nabble.com.