RE: [R] PCA in R

From: Liaw, Andy <andy_liaw_at_merck.com>
Date: Thu 15 Jul 2004 - 06:19:47 EST


When all else fails, RTFM; e.g., see ?princomp and read it in its entirety. Then maybe also try running example(princomp).

Andy

> From: Herman, David (NIH/NIMH)
>
> Hello,
> I'm attempting to run a PCA on an example data
> set. I ran it
> just fine, but I don't know how to few the output? I listed what the
> variable got stored in it, but I don't know how I can get
> anything else out
> of it. Are there other ways to view the results?
> Also, I'm confused about the last line "6 variables and 8
> observations"
> Aren't the rows the variables and the columns the observations?
>
> (NOTE: if anyone knows a good guide for doing a PCA on an
> example data set,
> from start to finish, it would be greatly appreciated)
>
> > m
> [,1] [,2] [,3] [,4] [,5] [,6]
> [1,] 1 2 3 4 5 6
> [2,] 3 4 3 7 8 1
> [3,] 1 2 3 4 5 6
> [4,] 8 7 4 1 4 3
> [5,] 1 2 3 4 5 6
> [6,] 4 5 8 2 1 3
> [7,] 9 8 7 6 7 8
> [8,] 1 3 7 3 5 0
> > pc.cr<-princomp(m,cor=TRUE)
> > pc.cr
> Call:
> princomp(x = m, cor = TRUE)
>
> Standard deviations:
> Comp.1 Comp.2 Comp.3 Comp.4 Comp.5
> Comp.6
> 1.545609e+00 1.407093e+00 9.886649e-01 7.539927e-01 2.919276e-01
> 2.460515e-09
>
> 6 variables and 8 observations.
> >
>
> thanks!
> Dave
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>



R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jul 15 06:29:12 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:54:58 EST