Specifying a prior distribution for tip dates

694 views
Skip to first unread message

Pieter

unread,
Jun 17, 2016, 3:21:31 AM6/17/16
to beast-users
I'm doing a divergence dating analysis using dated bacterial sequences. Because this particular pathogen has a latent period, the isolation dates might be considerably older than the actual infection dates. I'd like to model this uncertainty by specifying a prior for the tree tip dates. I.e. I'd like to do something similar to what is described in the following figure: http://onlinelibrary.wiley.com/enhanced/figures/doi/10.1111/mec.13586#figure-viewer-mec13586-fig-0004

Is it possible to set a specific prior for the tip dates in beast 2.4.1? And if so, can this be done for all the provided tip dates simultaneously?

This topic (https://groups.google.com/forum/#!topic/beast-users/qjz_tmysVSo) from 2015 says that "tip sampling" was not possible in BEAUTI at the time. However, it seems that the authors made a distinction between tip calibration priors and tip sampling, yet I'm not familiar with what this last concept entails. This tutorial also talks about tip sampling, http://beast2.org/2015/06/09/sampling-tip-dates/ . I believe the "tip calibration in XML" section is what I'm really after (i.e. specifying a prior on the tip dates to model uncertainty), but what is the following section, "tip sample operator in XML", describing then?

Thanks for your time,
Pieter

Remco Bouckaert

unread,
Jun 19, 2016, 4:22:16 PM6/19/16
to beast...@googlegroups.com
Hi Pieter,

If I understand you correctly, you want to specify a single prior distribution for a set of tips, and sample these tips. To do this, you specify a taxon set in the priors tab in BEAUti, by clicking the small ‘+’ button at the bottom of the screen and a dialog pops up that allows you to select the taxa you are interested in. Once you are done and return to the priors tab, a new entry is created. Click the small triangle next to that entry, and details are shows of the distribution, as well as a check box labelled ‘Tips only’. If you check that box, the distribution will be applied to each of the tips.

You still need to add a tip-dates random walk operator, as explained in the blog post (http://beast2.org/2015/06/09/sampling-tip-dates) you referred to.

Hope this helps,

Remco


--
You received this message because you are subscribed to the Google Groups "beast-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beast-users...@googlegroups.com.
To post to this group, send email to beast...@googlegroups.com.
Visit this group at https://groups.google.com/group/beast-users.
For more options, visit https://groups.google.com/d/optout.

Pieter

unread,
Jun 23, 2016, 7:39:13 AM6/23/16
to beast-users
Thanks for your reply Remco! I have two follow-up questions though:

The way I understand your explanation and the tutorial you linked to, I'd have to first define taxon sets for each of my dated taxa/tips. Next, I'd need to add as many random walk operators as I have taxon sets (which each contain exactly one taxon/tip at this point). My initial understanding was that I'd have to create a single taxon set which included all of my dates tips/taxa, rather than multiple taxon sets each containing a single tip.

So what I'd have to do to assign priors to each of my dated tips is the following:

  1. In BEAUti, load in the alignment, setup the site model, clock model, priors and MCMC as usual and import the tip dates.

  2. a) Create a taxon set containing exactly one dated tip/taxon (e.g. taxon A), choose a prior (e.g. log normal) and check "tips only".

    b) To automate this for all of the tips, add an entry like this to the distribution element of the XML; one taxon set entry for each dated tip: taxon A, taxon B, ....

    <distribution id="taxonSetForTipA.prior" 
    spec="beast.math.distributions.MRCAPrior" tipsonly="true" 
    tree="@Tree.t:tree">
                     <taxonset id="taxonSetForTipA" spec="TaxonSet">
                         <taxon id="taxon1" spec="Taxon"/>
                     </taxonset>
                     <LogNormal id="LogNormalDistributionModel.0" 
    meanInRealSpace="true" name="distr">
                         <parameter 
    id="parameter.hyperLogNormalDistributionModel-M-taxonSetForTipA.prior" 
    estimate="false" name="M">1.0</parameter>
                         <parameter 
    id="parameter.hyperLogNormalDistributionModel-S-taxonSetForTipA.prior" 
    estimate="false" lower="0.0" name="S" upper="5.0">1.25</parameter>
                     </LogNormal>
    </distribution>
    <distribution id="taxonSetForTipB.prior" ...

  3. Add the tip priors to the logger section:

     <log idref="taxonSetForTipA.prior"/>
             <log idref="taxonSetForTipB.prior"/>
             ...

  4. Define a random walker for each of the tips, i.e. one for each of the taxon sets defined earlier:

         <operator id="TipDatesRandomWalker.01"
         windowSize="1"
         spec="TipDatesRandomWalker"
         taxonset="@taxonSetForTipA"
         tree="@Tree.t:tree"
         weight="1.0"/>
    <operator id="TipDatesRandomWalker.02" ...

Could you confirm this is the correct way to go about it?


My second question is related to the prior distribution for these tip dates. I'd like to set a hard boundary on the date I have, while allowing for earlier dates with decreasing probabilities (but no later dates after the date I have). Is it possible to mirror or reverse the exponential distribution in BEAUti? I.e. for a tip date in 2005, I'd like the boundary to be 2005 and the exponential to go back in time. Or is it easier to achieve this by defining my dates as "time before the present" rather than "time since the past"?


Thanks for your help,

Pieter


Op zondag 19 juni 2016 22:22:16 UTC+2 schreef Remco Bouckaert:

Remco Bouckaert

unread,
Jun 26, 2016, 3:48:01 PM6/26/16
to beast...@googlegroups.com
Hi Pieter,


The way I understand your explanation and the tutorial you linked to, I'd have to first define taxon sets for each of my dated taxa/tips. Next, I'd need to add as many random walk operators as I have taxon sets (which each contain exactly one taxon/tip at this point). My initial understanding was that I'd have to create a single taxon set which included all of my dates tips/taxa, rather than multiple taxon sets each containing a single tip.


It depends on the calibration for the tips; if you have many tips that share the same age distribution, you can define a single taxonset containing all taxa and set tipsonly=“true” on the MRCAPrior. That way, all tips will share the same age distribution, the one defined for the MRCAPrior. If tips have different age distributions, you need to define a separate set for each taxon.
That looks good to me.

My second question is related to the prior distribution for these tip dates. I'd like to set a hard boundary on the date I have, while allowing for earlier dates with decreasing probabilities (but no later dates after the date I have). Is it possible to mirror or reverse the exponential distribution in BEAUti? I.e. for a tip date in 2005, I'd like the boundary to be 2005 and the exponential to go back in time. Or is it easier to achieve this by defining my dates as "time before the present" rather than "time since the past"?

That is probably best achieved by defining dates as “time before present”, since there is no way to mirror a distribution.

Cheers,

Remco


Pieter

unread,
Jun 30, 2016, 5:28:59 AM6/30/16
to beast-users
Many thanks for all your help, Remco!

Op zondag 26 juni 2016 21:48:01 UTC+2 schreef Remco Bouckaert:
Reply all
Reply to author
Forward
0 new messages