Re: [R-sig-phylo] phylogenetic circular linear regression

2017-07-27 Thread Peter Smits
Hi,

If your adventurous you could probably write your own model  in R or Stan
or similar. The wrapped Normal or the Von Mise distribution are circular
and map from 0 to 2pi. My suggestion would be to include a species level
phylogenetic "random effect" for the mean parameter to account for the
autocorrelation. This is how the MCMCglmm package includes phylogeny.

If you write it as sampling statements it might look like

y ~ MV(mu, k)
mu = a + bx + h
h ~ MVN (Mu, Sigma)

Hope that helps lead you on the right track.

Cheers,

Peter


On Thu, Jul 27, 2017, 4:07 AM f.k...@mailbox.org  wrote:

> Hi all,
>
> it there something like a phylogenetic circular linear regression or such?
>
> I want to test if the hue (circular 360°) of species differs between two
> lifestyles?
>
> Hope someone can help?
>
> If this is not there please also let me know.
>
> Cheers,
> Franz
>
> ___
> 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/

-- 
Peter D Smits
Postdoctoral Researcher (Finnegan lab)
Integrative Biology
University of California Berkeley
https://psmits.github.io/

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

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

2017-07-27 Thread Jesse Delia
Thank you everyone for your help, I really appreciate it!

On Wed, Jul 26, 2017 at 11:55 AM, Jarrod Hadfield 
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 
>> 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
>>>
>>> When replying, please edit your Subject line so it is more specific
>>> 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 
>>> 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

Re: [R-sig-phylo] phylogenetic circular linear regression

2017-07-27 Thread Florian Boucher
Hi again Frank,

I just realized that a sine or cosine transformation would leave you with
opposite colors on the hue having the same value... probably not so handy.
Sorry, that was a poor suggestion...

Florian

2017-07-27 14:09 GMT+02:00 Florian Boucher :

> Hi Franz,
>
> I don't know about anything like what you propose but maybe you could
> sine-transform your trait and then use phylogenetic linear or logistic
> regression?
>
> Florian
>
> 2017-07-27 13:06 GMT+02:00 f.k...@mailbox.org :
>
>> Hi all,
>>
>> it there something like a phylogenetic circular linear regression or such?
>>
>> I want to test if the hue (circular 360°) of species differs between two
>> lifestyles?
>>
>> Hope someone can help?
>>
>> If this is not there please also let me know.
>>
>> Cheers,
>> Franz
>>
>> ___
>> 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/

Re: [R-sig-phylo] phylogenetic circular linear regression

2017-07-27 Thread Florian Boucher
Hi Franz,

I don't know about anything like what you propose but maybe you could
sine-transform your trait and then use phylogenetic linear or logistic
regression?

Florian

2017-07-27 13:06 GMT+02:00 f.k...@mailbox.org :

> Hi all,
>
> it there something like a phylogenetic circular linear regression or such?
>
> I want to test if the hue (circular 360°) of species differs between two
> lifestyles?
>
> Hope someone can help?
>
> If this is not there please also let me know.
>
> Cheers,
> Franz
>
> ___
> 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] phylogenetic circular linear regression

2017-07-27 Thread f.k...@mailbox.org
Hi all,

it there something like a phylogenetic circular linear regression or such?

I want to test if the hue (circular 360°) of species differs between two 
lifestyles?

Hope someone can help?

If this is not there please also let me know.

Cheers, 
Franz

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