-------- Original Message -------- Subject: Re: modularity hypotheses for subsets of landmarks in a single configuration Date: Mon, 25 Jul 2011 14:51:52 -0400 From: Fabio de A. Machado <[email protected]> To: [email protected] Dear John, I have written an R function that allows you to perform 2BPLS on different landmarks of a single configuration. All you have to do is to specify the configuration and the indexes of the landmarks for each block. It only works with two blocks. It did not include size correction, but it can be performed previous to the analysis using codes provided by McCoy et al (Size correction: comparing morphological traits among populations and environments. Oecologia (2006) vol. 148 (4) pp. 547-554). I'm sending the code down bellow with a brief explanation. I've based the code on Mitteroecker & Bookstein (The evolutionary role of modularity and integration in the hominoid cranium. Evolution (2008) vol. 62 (4) pp. 943-958). The permutations are still a bit slow. I can anticipate one criticism, which is that the permutated configurations are not re-superimposed. This could be easily fixed, but I compared the results using re-superposition and without using it and fount the last to be more conservative (a.i. it finds fewer significant singular-warps). Furthermore, in my sample at least, the results using this approach and evaluating both blocks independently superimposed produced the same number of significant axes. I welcome any criticisms and comments. Best, Fabio A. Machado Laboratório de Herpetologia/Morfometria Museu de Zoologia da USP Av. Nazaré, 481, Ipiranga São Paulo, SP, 04263-000 +55 11 20658130 [email protected] <mailto:[email protected]> ; [email protected] <mailto:[email protected]> +55 11 82631029 -------------------------- R code – Code for the shape 2B-PLS implemented following Mitteroecker & Bookstein (2008). The function requires as input 3 objects (“rotated”, B1 and B2) and 2 parameters (“rand” and “alpha”). “rotated” is an object of rotated configurations following the object structure in “shapes” package (Dryden, 2009). B1 and B2 are numeric vectors indicating each landmark belongs to each block. The parameters “rand” and “alpha” are related to the permutation analysis. Users can estipulate the number of permutations and the significance threshold. If alpha is not given, then the function uses alpha=0.05 if the number of randomizations is smaller then 9999 or alpha=0.01 if it is equal or superior to this value, following Manly (1997). The analysis can be performed on objects that belong to different morphological structures. This can be done by independently superimposing the configurations and subsequently appending them in a sigle object that can be used as input. The function output consists of a list containing: table- the 2B-PLS summary statistics of the significant singular warps, F- scaled axis of common factors, F1- axis for the first block (B1), F2- axis for the second block (B2), D- singular values, cfscores- individual scores on the common factor axis, F1scores- individual scores for the first axis, F2scores- individual scores for the second axis, R- residual morphospace after the removal of the significant principal warps. shape.pls<- function (rotated,B1,B2,rand=999,alpha=NULL){ if (is.null(alpha))if (rand<9999) alpha<-0.05 else alpha<-0.01 M1<-rotated[B1,,] dM1<-dim(M1) M1<-aperm(M1,c(2,1,3)) dim(M1)<-c(dM1[1]*dM1[2],dM1[3]) M1<-t(M1) M1<-scale(M1,center=TRUE,scale=FALSE) M2<-rotated[B2,,] dM2<-dim(M2) M2<-aperm(M2,c(2,1,3)) dim(M2)<-c(dM2[1]*dM2[2],dM2[3]) M2<-t(M2) M2<-scale(M2,center=TRUE,scale=FALSE) vM12<-(t(M1)%*%M2)/(dM1[3]-1) sM12<- svd(vM12) D <- sM12$d; F1 <- sM12$u; F2 <- sM12$v pD<-matrix(0,sum(round(100*D/sum(D),2)>0),rand) for (i in 1:rand){ vm12<-(t(M1)%*%M2[sample(1:dM1[3]),])/(dM1[3]-1) pD[1,i]<-svd(vm12)$d[1] for(j in 2:sum(round(100*D/sum(D),2)>0)){ zM1<-M1-M1%*%F1[,1:(j-1)]%*%t(F1[,1:(j-1)]) zM2<-M2-M2%*%F2[,1:(j-1)]%*%t(F2[,1:(j-1)]) vm12<-(t(zM1)%*%zM2[sample(1:dM1[3]),])/(dM1[3]-1) pD[j,i]<-svd(vm12)$d[1] } } sD<-matrix(0,sum(round(100*D/sum(D),2)>0),2) sD[,1]<-round(100*D[1:sum(round(100*D/sum(D),2)>0)]/sum(D),2) for(i in 1: sum(round(100*D/sum(D),2)>0)) sD[i,2]<-round((sum(pD[i,]>D[i])+1)/(rand+1),3) sigDM<-sum(sD[,2]<alpha) F<-matrix(0,(dM1[1]+dM2[1])*dM1[2],sigDM) for(i in 1:sigDM){ C<-matrix(0,dM1[3],2) C[,1]<-M1%*%F1[,i] C[,2]<-M2%*%F2[,i] e<-eigen(t(C)%*%C)$vectors[,1] F[,i]<-c(e[1]*c(F1[,i]),e[2]*c(F2[,i])) } X<-cbind(M1,M2) sM1<-M1%*%F1 sM2<-M2%*%F2 table<-matrix(NA,sigDM,5, dimnames= list(1:sigDM,c("Covar.","Cor.","Ex.Var.","Ex.Covar.","p"))) for (i in 1: sigDM) { table[i,1]<-cov(sM1[,i],sM2[,i]) table[i,2]<-round(cor(sM1[,i],sM2[,i]),3) table[i,3]<-round(var(X%*%F[,i])/sum(diag((t(X)%*%X)/(dM1[3]-1)))*100,2) } table[,4:5]<-sD[1:sigDM,] list ("table"=table, "F"=F, "F1"=F1, "F2"=F2, "D"=D, "cfscores"=X%*%F,"F1scores"=M1%*%F1,"F2scores"=M2%*%F2, "R"=X-X%*%F%*%t(F)) } Em 25/07/2011, às 14:27, morphmet escreveu:
-------- Original Message -------- Subject: modularity hypotheses for subsets of landmarks in a single configuration Date: Sun, 24 Jul 2011 14:30:44 -0400 From: John Denton <[email protected] <mailto:[email protected]>> To: [email protected] <mailto:[email protected]> Hi all, I am interested in tests using subsets within a single configuration, especially for modularity hypotheses (sensu Klingenberg [2009]), and comparing them to fits with two separate blocks. It appears that MorphoJ does not yet implement modularity hypotheses for subsets within a single configuration, and I am wondering if there is a package in R, or a script, that is available for such an analysis that includes an allometric correction before running. Also, I am also working a bit with fluctuating asymmetry, and have a question about its use with subsets in a single configuration--is the problem with running modularity analyses on a subset of the asymmetric component of a Procrustes ANOVA without reference to the total configuration alleviated if the the modularity hypothesis is run assessing subsets within the total configuration? Lastly, I'm wondering about methods for assessing digitization error (the error term in Procrustes ANOVA)--for example, is there a way to get these results by looking at the contributions to a matrix correlation between symmetric and asymmetric components by the diagonal and off-diagonal entries, instead of digitizing all samples multiple times? Thanks very much! ~John -- "ORGANIC LIFE beneath the shoreless waves Was born and nurs'd in ocean's pearly caves; First forms minute, unseen by spheric glass, Move on the mud, or pierce the watery mass; These, as successive generations bloom, New powers acquire and larger limbs assume; Whence countless groups of vegetation spring, And breathing realms of fin and feet and wing." ~Erasmus Darwin, The Temple of Nature Canto I.V
