Jan Kleinn wrote:> I'm trying to make a screeplot including the Cumulative Proportion of
> the Variance, something that can easily be done in S-Plus with
> 'screeplot(pc.object,cumulative=T)'. How can I access the
Proportion of
> Variance in an princomp object and how could I get the Cumulative
> Proportion of the Variance on the screeplot?
>From start to screeplot:
library(mva)
mydata <- mvrnorm(300, rep(0, 4), diag(4))
my.pcomp <- princomp(mydata)
y <- my.pcomp$sdev^2
cpropvar <- cumsum(my.pcomp$sdev^2 / sum(my.pcomp$sdev^2))
x <- barplot(y, col=rep(1, dim(mydata)[2]), ylim=c(0, 6))
text(x, y + 0.25, round(cpropvar, 2), adj=0.5)
To suit your data, you would need to play with the ylim parameters and the
distance of the cumulative proportion of variance labels from the tops of the
bars.
HTH,
Chuck
-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>-
Chuck Cleland
Institute for the Study of Child Development
UMDNJ--Robert Wood Johnson Medical School
97 Paterson Street
New Brunswick, NJ 08903
phone: (732) 235-7699
fax: (732) 235-6189
http://www2.umdnj.edu/iscdweb/
http://members.nbci.com/cmcleland/
-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>-<>-
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._