[adegenet-commits] r159 - pkg/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jul 23 15:09:55 CEST 2008


Author: jombart
Date: 2008-07-23 15:09:55 +0200 (Wed, 23 Jul 2008)
New Revision: 159

Modified:
   pkg/man/scale.Rd
Log:
Modified the example.


Modified: pkg/man/scale.Rd
===================================================================
--- pkg/man/scale.Rd	2008-07-23 09:25:22 UTC (rev 158)
+++ pkg/man/scale.Rd	2008-07-23 13:09:55 UTC (rev 159)
@@ -58,19 +58,26 @@
 if(require(ade4)){
 ## compute PCAs
 pcaObj <- dudi.pca(obj,scale=FALSE,scannf=FALSE) # pca with no scaling
-pcaX1 <- dudi.pca(X1,scale=FALSE,scannf=FALSE) # pca with usual scaling
-pcaX2 <- dudi.pca(X2,scale=FALSE,scannf=FALSE) # pca with scaling for binomial variance
+pcaX1 <- dudi.pca(X1,scale=FALSE,scannf=FALSE,nf=100) # pca with usual scaling
+pcaX2 <- dudi.pca(X2,scale=FALSE,scannf=FALSE,nf=100) # pca with scaling for binomial variance
 
-## change signs of loadings if needed
-if(cor(pcaX1$c1[,1],pcaX2$c1[,1]) < 0) {pcaX1$c1[,1] <- -pcaX1$c1[,1]}
-if(cor(pcaX1$c1[,2],pcaX2$c1[,2]) < 0) {pcaX1$c1[,2] <- -pcaX1$c1[,2]}
+## get the loadings of alleles for the two scalings
+U1 <- pcaX1$c1
+U2 <- pcaX2$c1
 
+
+## find an optimal plane to compare loadings
+## use a procustean rotation of loadings tables
+pro1 <- procuste(U1,U2,nf=2)
+
 ## graphics
 par(mfrow=c(2,2))
+# eigenvalues
 barplot(pcaObj$eig,main="Eigenvalues\n no scaling")
 barplot(pcaX1$eig,main="Eigenvalues\n usual scaling")
 barplot(pcaX2$eig,main="Eigenvalues\n 'binomial' scaling")
-s.match(pcaX1$c1,pcaX2$c1,clab=0,sub="usual -> binom")
+# differences between loadings of alleles
+s.match(pro1$scor1,pro1$scor2,clab=0,sub="usual -> binom (procustean rotation)")
 }
 }
 \keyword{methods}



More information about the adegenet-commits mailing list