----- Forwarded message from Ryan Felice <ryanfel...@gmail.com> -----

     Date: Sat, 20 Apr 2013 13:29:02 -0400
      From: Ryan Felice <ryanfel...@gmail.com>
      Reply-To: Ryan Felice <ryanfel...@gmail.com>
      Subject: Re: calculating phylogenetic signal in EFA data
      To: morphmet@morphometrics.org

Thanks Dean!

Karl- I would be happy to share the code. I am curious to see if it
works for you. Let me know if you notice any errors. Basically what I
have done is cut out the beginning of the "physignal" function of
{geomorph} so that the rest of the code will play nice with my data
matrix. I also changed all of the references to "getAncStates" to
"fastAnc" (for compatability with the most recent version of
{geiger}). I put my normalized elliptical fourier descriptors in a
matrix in the following format. 

row.names          A1     A2     A3       B1        B2       B3
C1          C2         C3       D1...... 
Species1             1 0.0402 0.0393 2.47e-16 -0.1010 0.0436 -3.88e-17
-0.1820 -0.03580 0.531..... 
Species2             1 0.0211 0.0663 8.74e-16 -0.0820 0.0428 -4.41e-17
-0.0484 -0.02060 0.546..... 

Here is the code:

EFA.phylo.signal<-function(phy,A,iter=999)
{
require(ape)
require(geiger)
N<-length(phy$tip.label)
A<-A[phy$tip.label,]
SSC.o<-NULL
anc.states<-matrix(NA,nrow=(nrow(A)-1),ncol=ncol(A))
for (i in 1:ncol(A)){
anc.states[, i]<- fastAnc(phy,A[, i])
}
dist.mat <- as.matrix(dist(rbind(as.matrix(A), as.matrix(anc.states)))^2)
SSC.o<-0
for (i in 1:nrow(phy$edge)) {
SSC.o <- SSC.o + dist.mat[phy$edge[i, 1], phy$edge[i, 2]]
}
P.val <- 1
for (i in 1:iter) {
A.r <- A[sample(nrow(A)), ]
row.names(A.r) <- row.names(A)
SSC.r <- NULL
anc.states <- matrix(NA, nrow = (nrow(A) - 1), ncol = ncol(A))
for (i in 1:ncol(A.r)) {
anc.states[, i] <- fastAnc(phy,A.r[, i])
}
dist.mat.r <- as.matrix(dist(rbind(as.matrix(A.r), as.matrix(anc.states)))^2)
SSC.r <- 0
for (i in 1:nrow(phy$edge)) {
SSC.r <- SSC.r + dist.mat.r[phy$edge[i, 1], phy$edge[i,2]]
}
P.val <- ifelse(SSC.r <= SSC.o, P.val + 1, P.val)
}
P.val <- P.val/(iter + 1)
return(list(phy.signal = SSC.o, pvalue = P.val))
}

-Ryan
Ryan Felice
PhD Candidate
Ohio University Department of Biological Sciences
107 Irvine Hall
Athens, OH 45701
www.rnfelice.com
ryanfel...@gmail.com
(201)981-8642

On Fri, Apr 19, 2013 at 10:23 PM,  <morphmet_modera...@morphometrics.org> wrote:
>
> ----- Forwarded message from Karl Fetter <karl.fet...@gmail.com> -----
>
> Date: Wed, 17 Apr 2013 11:34:22 -0400
> From: Karl Fetter <karl.fet...@gmail.com>
> Reply-To: Karl Fetter <karl.fet...@gmail.com>
>
>
> Subject: Re: calculating phylogenetic signal in EFA data
> To: morphmet@morphometrics.org
>
> Hi Ryan
>
> Would you be willing to share the altered code you made for testing
> phylogenetic signal with EFA data?
>
> Karl Fetter
>
>
> On Tue, Apr 16, 2013 at 10:11 PM, <morphmet_modera...@morphometrics.org>
> wrote:
>>
>>
>> ----- Forwarded message from Ryan Felice <ryanfel...@gmail.com> -----
>>
>>      Date: Mon, 15 Apr 2013 10:04:53 -0400
>>       From: Ryan Felice <ryanfel...@gmail.com>
>>       Reply-To: Ryan Felice <ryanfel...@gmail.com>
>>       Subject: calculating phylogenetic signal in EFA data
>>       To: morphmet@morphometrics.org
>>
>> Hello-
>>
>> I am using EFA to quantify shape, and I want to measure phylogenetic
>> signal in this data. I think the best way to do this is using the
>> permutation test described by Klingenberg, and Gidaszewski (2010) and
>> implemented as the "physignal" function in the {geomorph} package in
>> R. By tweaking the code for "physignal" a little bit, I have managed
>> to get the function to run with my EFA data and return a result,
>> although it goes quite slowly. Is there any reason that this method,
>> which was developed for landmark data, should not be used with other
>> types of multidimensional data?
>>
>> Cheers,
>>
>> Ryan Felice
>> PhD Candidate
>> Ohio University Department of Biological Sciences
>> 107 Irvine Hall
>> Athens, OH 45701
>> www.rnfelice.com
>> ryanfel...@gmail.com
>> (201)981-8642
>>
>> ----- End forwarded message -----
>>
>
>
>
> ----- End forwarded message -----
>
>
>

----- End forwarded message -----

Reply via email to