
Thanks, that is exactly what I was looking for.
regardskonrad



> Subject: AW: [R-SIG-Finance] princomp(): how to get the component's names
> Date: Wed, 2 Dec 2009 17:27:49 +0100
> From: Zeno.Adams@ebs.edu
> To: konradhoppe@hotmail.de; r-sig-finance@stat.math.ethz.ch
> 
> You can look at the loadings by using summary(pca, loadings = TRUE)
> 
> In your case x,y, and z are uncorrelated so that each principal component has 100% loading on one factor but zero on all the others.
> 
> If you modify your example a little so that the series are at least somewhat correlated, e.g.
> ^
> x <- 1:300 + rnorm(300)
> 
> y <- 0.8*x + runif(300)
> 
> z <- 0.2*x + rnorm(300, mean=10, sd=5)
> 
> dat <- data.frame(x,y,z)
> 
> pca <- princomp(dat, corr=T)
> 
> 
> then
> 
> s <- summary(pca, loading = TRUE)
> 
> will give you more meaningful loadings.
> 
> For instance, if you are interested in creating an index of the three series you could use the command
> 
> PC1 <- as.matrix(dat) %*% as.matrix(loadings(s)[,1]/sum(loadings(s)[,1]))
> (this is probably not the most elegant way of doing it, but I cant see a shorter way at the moment)
> 
> plot(x, type = "l")
> lines(y, type = "l", col = 2)
> lines(z, type = "l", col = 3)
> lines(PC1, type = "l", col = 4, lty = 2, lwd = 2)
> 
> 
> hope this helps
> 
> Zeno
> 
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: r-sig-finance-bounces@stat.math.ethz.ch [mailto:r-sig-finance-bounces@stat.math.ethz.ch] Im Auftrag von Konrad Hoppe
> Gesendet: Mittwoch, 2. Dezember 2009 16:55
> An: r-sig-finance@stat.math.ethz.ch
> Betreff: [R-SIG-Finance] princomp(): how to get the component's names
> 
> Dear mailing list members,
> 
>  
> 
> I got a question about principal component analysis. I know that's not the
> main topic here, but perhaps somebody have used it already. I'm wondering
> how to get the names of the particular components.
> 
>  
> 
> Let me give you an example:
> 
>  
> 
> x <- rnorm(300)
> 
> y <- runif(300)
> 
> z <- rnorm(300, mean=10, sd=5)
> 
> dat <- data.frame(x,y,z)
> 
> pca <- princomp(dat, corr=T)
> 
> summary(pca)
> 
>  
> 
> and now I would like to know which is for example the first component?
> 
> Can anybody help me?
> 
>  
> 
> regards
> 
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-SIG-Finance@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
> 
> EBS European Business School gemeinnuetzige GmbH - Sitz der Gesellschaft: Wiesbaden, Amtsgericht Wiesbaden HRB 19951 - Umsatzsteuer-ID DE 113891213 Geschaeftsfuehrer: Prof. Dr. Christopher Jahns,  Praesident; Prof. Dr. Rolf Tilmes, Dekan; Sabine Fuchs, CMO; Aufsichtsrat: Dr. Hellmut K. Albrecht, Vorsitzender
 		 	   		  
_________________________________________________________________

[[elided Hotmail spam]]
	[[alternative HTML version deleted]]

