Hi all, I'm new to PCA in R, so this might be a basical thing, but I cannot find anything on the net about it. I need to make a PCA plot with two response variables (df$resp1 and df$resp2) against eight metabolites (df$met1, df$met2, ...) and I don't have a clue how to do... and I've only used the simplest PCAs before, like this: pcaObj=prcomp(t(df[idx, c(40:47)])) biplot(pcaObj) Anyone who knows how to do? Best rageds, Joel _________________________________________________________________ Hitta hetaste singlarna på MSN Dejting! http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952 [[alternative HTML version deleted]]
After an off-list email exchange, it sounds like the pls package and Partial Least Squares are appropriate for this analysis. Kevin Wright 2009/11/4 Joel Fürstenberg-Hägg <joel_furstenberg_hagg@hotmail.com>> > Hi all, > > > > I'm new to PCA in R, so this might be a basical thing, but I cannot find > anything on the net about it. > > I need to make a PCA plot with two response variables (df$resp1 and > df$resp2) against eight metabolites (df$met1, df$met2, ...) and I don't have > a clue how to do... and I've only used the simplest PCAs before, like this: > > > > pcaObj=prcomp(t(df[idx, c(40:47)])) > > biplot(pcaObj) > > > > Anyone who knows how to do? > > > > Best rageds, > > > > Joel > > _________________________________________________________________ > Hitta hetaste singlarna på MSN Dejting! > http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952 > [[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. > >[[alternative HTML version deleted]]
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]]