# Re: [R-sig-phylo] selecting a set of incongruent trees from a posterior distribution

Thank you everyone for your help, I really appreciate it!

wrote:

> Hi Jesse,
>
> In order to account for phylogenetic uncertainty you are better just
> pulling trees from their posterior rather than choosing trees that are
> incongruent. The latter will give estimates biased toward those associated
> with extreme trees.
>
> If the analysis is the binomial model you posted on R-sig-mixed you can
> speed up the analysis by passing the latent variables from one model as the
> starting values in the next model without a long burn-in. If the data are
> Gaussian you just need to pass the (co)varinaces as starting values.
>
> Code is below. It is untested, and clearly you need to replace ... with
> the exact specifications of the model.
>
> Note that this type of approach is still biased towards a lambda/h2 of 0.
> To fix that you would need to simultaneously estimate the phylogeny and the
> parameters of the comparative analysis. The bias is probably small if the
> tree is well estimated, and doing it 'properly' would be difficult -
> perhaps BEAST can do it.
>
> Cheers,
>
> Jarrod
>
> ntree<-100  # number of trees
>
> nsample<-100 # number of samples per tree
>
> thin<-10 # thinning interval
>
> model_all<-MCMCglmm(...., pl=TRUE)  # initial model object to which
> results will be written
>
> model_i<-model_all
>
> model_all\$Sol<-matrix(NA, nsample*ntree, ncol(model_all\$Sol))
>
> model_all\$VCV<-matrix(NA, nsample*ntree, ncol(model_all\$VCV))
>
> # create empty matrices for writing results from each tree
>
> for(i in 1:ntree){
>
> # iterate over trees
>
> model_i<-MCMCglmm(...., pl=TRUE, start=list(liab=model_i\$Liab[nsample,]),
> pedigree=tree[[i]], burnin=thin, thin=thin, nitt=thin*(nsample+1))
>
> # fit model to tree i using starting values from previous model
>
> model_all\$Sol[(i-1)*nsample+1:nsample]<-model_i\$Sol
>
> model_all\$VCV[(i-1)*nsample+1:nsample]<-model_i\$VCV
>
> }
>
> model_all\$Sol<-mcmc(model_all\$Sol, thin=thin)
>
> model_all\$VCV<-mcmc(model_all\$VCV, thin=thin)
>
>
>
> On 26/07/2017 16:06, Santiago Sánchez wrote:
>
>> Hi Jesse,
>>
>> As Eduardo says, if in fact you want to see how different trees are from a
>> "consensus", something that you could try is find the
>> maximum-clade-credibility (MCC) tree (you can do this with treeAnnotator
>> from BEAST). This will be a fully bifurcating tree and is essentially the
>> tree in the posterior distribution that maximizes  the overall clade
>> posterior probabilities (e.g. sum(posterior)). Once you have the MCC tree,
>> you can use the Robinson-Foulds distance metric (there is a function in
>> phytools) to compare all the topologies in your posterior distribution.
>> The
>> trees with the lowest values will be the most incongruent with respect to
>> the MCC tree. Just remember to exclude the burnin.
>>
>> Cheers,
>> Santiago
>>
>> On Wed, Jul 26, 2017 at 6:01 AM <r-sig-phylo-requ...@r-project.org>
>> wrote:
>>
>> Send R-sig-phylo mailing list submissions to
>>>          r-sig-phylo@r-project.org
>>>
>>> To subscribe or unsubscribe via the World Wide Web, visit
>>>          https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
>>> or, via email, send a message with subject or body 'help' to
>>>          r-sig-phylo-requ...@r-project.org
>>>
>>> You can reach the person managing the list at
>>>          r-sig-phylo-ow...@r-project.org
>>>
>>> than "Re: Contents of R-sig-phylo digest..."
>>>
>>>
>>> Today's Topics:
>>>
>>>     1. selecting a set of incongruent trees from a posterior
>>>        distribution (Jesse Delia)
>>>     2. Re: selecting a set of incongruent trees from a posterior
>>>        distribution (Eduardo Ascarrunz)
>>>
>>>
>>> ----------------------------------------------------------------------
>>>
>>> Message: 1
>>> Date: Tue, 25 Jul 2017 16:16:30 -0400
>>> From: Jesse Delia <jdeli...@gmail.com>
>>> To: R-sig-phylo@r-project.org
>>> Subject: [R-sig-phylo] selecting a set of incongruent trees from a
>>>          posterior       distribution
>>> Message-ID:
>>>          <
>>> ca+lom6ehmv6c2v_lso8b2sdqqvoqwfcrl56-4jhcmicvjyv...@mail.gmail.com>
>>> Content-Type: text/plain; charset="UTF-8"
>>>
>>> Dear list,
>>>
>>> Does anyone know of a function or script that could select a set of the
>>> most incongruent trees from a list of trees? Maybe I missed a post, but
>>> haven't found anything.
>>>
>>> I running mixed models, which take a lot of computational space on my lap
>>> top. In effort to account for phylogenetic uncertainty, without having to
>>> run 100s of chains, I figured maybe i could run models across a (much)
>>> shorter list that accounts for more diversity in tree shape observed
>>> within
>>> the posterior distribution. Not sure if this makes sense, and/or is
>>> extremely complicated?
>>>
>>> Thanks for you time!
>>>
>>> Jesse
>>>
>>>          [[alternative HTML version deleted]]
>>>
>>>
>>>
>>> ------------------------------
>>>
>>> Message: 2
>>> Date: Wed, 26 Jul 2017 11:33:12 +0200
>>> From: Eduardo Ascarrunz <ear...@gmail.com>
>>> To: Jesse Delia <jdeli...@gmail.com>
>>> Cc: R Sig Phylo Listserv <R-sig-phylo@r-project.org>
>>> Subject: Re: [R-sig-phylo] selecting a set of incongruent trees from a
>>>          posterior distribution
>>> Message-ID:
>>>          <
>>> cakxhxpxj_8ucosjt-bzpzvsn+5quet9vxnd4ssd4bqaq-fp...@mail.gmail.com>
>>> Content-Type: text/plain; charset="UTF-8"
>>>
>>> Hi Jesse,
>>>
>>> Do you want to select the trees that are most incongruent with some sort
>>> of
>>> average of the tree distribution? The `treespace`and `phytools` packages
>>> have functions that compute average trees with different metrics, and
>>> they
>>> also allow you to measure the distance between each tree and the average
>>> tree.
>>>
>>> Cheers,
>>>
>>> Eduardo
>>>
>>> 2017-07-25 22:16 GMT+02:00 Jesse Delia <jdeli...@gmail.com>:
>>>
>>> Dear list,
>>>>
>>>> Does anyone know of a function or script that could select a set of the
>>>> most incongruent trees from a list of trees? Maybe I missed a post, but
>>>> haven't found anything.
>>>>
>>>> I running mixed models, which take a lot of computational space on my
>>>> lap
>>>> top. In effort to account for phylogenetic uncertainty, without having
>>>> to
>>>> run 100s of chains, I figured maybe i could run models across a (much)
>>>> shorter list that accounts for more diversity in tree shape observed
>>>>
>>> within
>>>
>>>> the posterior distribution. Not sure if this makes sense, and/or is
>>>> extremely complicated?
>>>>
>>>> Thanks for you time!
>>>>
>>>> Jesse
>>>>
>>>>          [[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]]
>>>
>>>
>>>
>>> ------------------------------
>>>
>>> Subject: Digest Footer
>>>
>>> _______________________________________________
>>> R-sig-phylo mailing list
>>> R-sig-phylo@r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
>>>
>>> ------------------------------
>>>
>>> End of R-sig-phylo Digest, Vol 114, Issue 10
>>> ********************************************
>>>
>>>
>
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
>

[[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/