Hi all,

 

I wonder what the difference is between the functions prcomp and the PCA 
plotting method used in example 3 from the fastICA package. They give totally 
different plots. The reason for asking is that I've earlier used prcomp, but 
now I should do an ICA, and I guess I cannot compare the PCA plot from prcomp 
with the ICA plot if the two PCA plots looks different?

 

Does anyone knows anything about this? Maybe there's a different approach 
that's better?

 

 

if(require(MASS))

{
   x <- mvrnorm(n = 1000, mu = c(0, 0), Sigma = matrix(c(10, 3, 3, 1), 2, 2))
   x1 <- mvrnorm(n = 1000, mu = c(-1, 2), Sigma = matrix(c(10, 3, 3, 1), 2, 2))
   X <- rbind(x, x1)
   a <- fastICA(X, 2, alg.typ = "deflation", fun = "logcosh", alpha = 1,
   method = "R", row.norm = FALSE, maxit = 200,
   tol = 0.0001, verbose = TRUE)
   par(mfrow = c(1, 3))
   plot(a$X, main = "Pre-processed data")
   plot(a$X%*%a$K, main = "PCA components")
   plot(a$S, main = "ICA components")
}


PC=prcomp (X, center=T, scale=T)
hcl=hclust(dist(df))
plot(PC$x[,1],PC$x[,2], main="PCA components (prcomp)")

 

 

Best regards,

 

Joel
                                          
_________________________________________________________________
Nya Windows 7 gör allt lite enklare. Hitta en dator som passar dig!
http://windows.microsoft.com/shop
        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to