Hi Karla,

Here is a way to compare nested models in order to assess the significance of 
rate differences for a given tree and mapped regimes (in a similar fashion to 
what is proposing Liam).


# Here a function to collapse the regimes

mappedTrees <- function(tree, names){

combined <- rowSums(tree$mapped.edge[,names])

allnames <- colnames(tree$mapped.edge)

to_remove <- allnames[!allnames%in%names]

newmat <- cbind(tree$mapped.edge[,to_remove], combined)

newnames <- c(to_remove,paste(names, collapse="_"))

colnames(newmat) <- newnames

tree$mapped.edge <- newmat

return(tree)

}


## A worked example

library(mvMORPH)

set.seed(1)

tree<-pbtree(n=80)

# Setting the regime states of tip species

sta<-as.vector(c(rep("Forest",20),rep("Savannah",30),rep("Mountains",30))); 
names(sta)<-tree$tip.label

# Making the simmap tree with mapped states

tree<-make.simmap(tree,sta , model="ER", nsim=1)

# Simulate the traits

sigma<-list(1,3,6)

theta<-c(0)

data<-mvSIM(tree, param=list(sigma=sigma, theta=theta), model="BMM", nsim=1)

# fit the models with common rate (fit_1), and different rates for each regimes 
(fit_2)

fit_1 <- mvBM(tree, data, model="BM1")

fit_2 <- mvBM(tree, data, model="BMM")


# Here a scenario where we assume that both Forest and Mountains regimes are 
similar

combined <- c("Forest", "Mountains")

treeForestMount <- mappedTrees(tree, combined)

fit_3 <- mvBM(treeForestMount, data, model="BMM")


# Then compare the three models

aicw(list(fit_1, fit_2, fit_3))


# Use LRT on the two multiple rates models

LRT(fit_2, fit_3)


All the best,


Julien



________________________________
De : R-sig-phylo <r-sig-phylo-boun...@r-project.org> de la part de Liam J. 
Revell <liam.rev...@umb.edu>
Envoy� : dimanche 23 juillet 2017 04:07
� : Karla Shikev
Cc : R-sig-phylo@r-project.org
Objet : Re: [R-sig-phylo] comparing rates of evolution of a phenotypic trait 
among clades

Hi Karla.

This is not yet possible, but it would be straightforward to add. For
instance, we could let the user specify different models such as A==B!=C
vs. A!=B==C and so on, and then compare this models in a standard way. I
will try to do this soon and then get back to you & the list.

All the best,

Liam J. Revell, Associate Professor of Biology
University of Massachusetts Boston
web: http://faculty.umb.edu/liam.revell/
Revell lab at UMass Boston - umb.edu<http://faculty.umb.edu/liam.revell/>
faculty.umb.edu
Welcome to the Revell lab webpages. This website contains information about 
research in the laboratory of Dr. Liam Revell. Research in the Revell lab takes 
place in ...



email: liam.rev...@umb.edu
blog: http://blog.phytools.org
[http://2.bp.blogspot.com/-R--OyW00QOU/WB-UaQC7MLI/AAAAAAAADRQ/afyJAHnQfCAKtRW4l1KE6EhtQKbq0ZE6gCK4B/s80/14915472_10154224922482872_7349753094314809681_n.jpg%253Foh%253D6b28620478ddf91f645e47f84b91f818%2526oe%253D5898CE31%2526__gda__%253D1485369678_e7db5dad2c7aa5d03d967bc8ccac9fab]<http://blog.phytools.org/>

Phylogenetic Tools for Comparative Biology<http://blog.phytools.org/>
blog.phytools.org
The following is a demo of the phytools functions & methods I used to create 
the graphics for my Evolution 2017 meeting talk entitled �Some additional new 
methods ...




On 7/22/2017 8:51 PM, Karla Shikev wrote:
> Thanks, Liam!
>
> Just a quick follow-up question: in the example I saw on your webpage (with
> three clades, one of which with a higher rate), how would you go about a
> sort of "post-hoc" test to determine which clades differ significantly from
> one another in their rates?
>
> Karla
>
> On Sat, Jul 22, 2017 at 4:13 PM, Liam J. Revell <liam.rev...@umb.edu> wrote:
>
>> Hi Karla.
>>
>> phytools has a function called ratebytree for this. This essentially
>> corresponds to the 'censored' model of O'Meara et al. 2006, but we also
>> have a submitted manuscript describing it. I can send you that in a second
>> email.
>>
>> For more information about using the function you can search for
>> 'ratebytree' on my blog, blog.phytools.org.
>>
>> All the best, Liam
>>
>> Liam J. Revell, Associate Professor of Biology
>> University of Massachusetts Boston
>> web: http://faculty.umb.edu/liam.revell/
Revell lab at UMass Boston - umb.edu<http://faculty.umb.edu/liam.revell/>
faculty.umb.edu
Welcome to the Revell lab webpages. This website contains information about 
research in the laboratory of Dr. Liam Revell. Research in the Revell lab takes 
place in ...



>> email: liam.rev...@umb.edu
>> blog: http://blog.phytools.org
[http://2.bp.blogspot.com/-R--OyW00QOU/WB-UaQC7MLI/AAAAAAAADRQ/afyJAHnQfCAKtRW4l1KE6EhtQKbq0ZE6gCK4B/s80/14915472_10154224922482872_7349753094314809681_n.jpg%253Foh%253D6b28620478ddf91f645e47f84b91f818%2526oe%253D5898CE31%2526__gda__%253D1485369678_e7db5dad2c7aa5d03d967bc8ccac9fab]<http://blog.phytools.org/>

Phylogenetic Tools for Comparative Biology<http://blog.phytools.org/>
blog.phytools.org
The following is a demo of the phytools functions & methods I used to create 
the graphics for my Evolution 2017 meeting talk entitled �Some additional new 
methods ...



>>
>>
>> On 7/22/2017 3:10 PM, Karla Shikev wrote:
>>
>>> Dear all,
>>>
>>> I'd like to test whether the rate of evolution of a phenotypic trait (e.g.
>>> body size) is significantly different among distantly-related clades (e.g.
>>> mammals vs birds). I got tip data and completely resolved and callibrated
>>> trees. One possibility would be to estimate rates and their confidence
>>> intervals for each clade and to compare them directly, but I'm sure
>>> there's
>>> a more elegant way to do this.
>>>
>>> Karla
>>>
>>>         [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-sig-phylo mailing list - R-sig-phylo@r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
>>> Searchable archive at http://www.mail-archive.com/r-
>>> sig-ph...@r-project.org/
>>>
>>>
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
> Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
r-sig-phylo - The Mail 
Archive<http://www.mail-archive.com/r-sig-phylo@r-project.org/>
www.mail-archive.com
Messages by Thread [R-sig-phylo] FW: error on finding the most distinctive 
clades Fernanda Coelho De Souza [R-sig-phylo] Is my subset of species random?



>

_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/
r-sig-phylo - The Mail 
Archive<http://www.mail-archive.com/r-sig-phylo@r-project.org/>
www.mail-archive.com
Messages by Thread [R-sig-phylo] FW: error on finding the most distinctive 
clades Fernanda Coelho De Souza [R-sig-phylo] Is my subset of species random?




        [[alternative HTML version deleted]]

_______________________________________________
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Reply via email to