Hi All, I'd like to build a package for the community that replicates the output produced by SAS "proc varclus". According to the SAS documentation, the first few steps are:
1. Find the first two principal components. 2. Perform an orthoblique rotation (quartimax rotation) on eigenvectors. 3. Assign each variable to the rotated component with which it has the higher squared correlation. The cartoon example below attempt to do this, but I found my results differ from SAS in "pc3" (i.e, the standardize component scores). I'd appreciate your help in whether you see anything wrong in "pc2" or "pc3"? set.seed(1) x1=rnorm(200); x2=0.9*x1; x3=0.7*x1; x4=x1*x1; x5=x1*x1*x1; x6=rnorm(200); x7=0.9*x6; x8=0.7*x6; x9=x6*x6; x10=x6*x6*x6; x <- cbind(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10) require(GPArotation) pc1 <- princomp(x, cor = TRUE, scores = TRUE) pc2 <- quartimax(pc1$loadings[,1:2],normalize=TRUE)$loadings pc3 <- scale(x%*% pc2) pc4 <- apply(x, 2, function(x) cor(x, pc3)^2) Thanks in advance for any help! Axel. [[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.