Sample a discrete trait

You need BEAST v2.1.0 and BEAST-classic v1.1.1. If you already have an older version of BEAST-classic installed, you have to re-install it to ensure you have version 1.1.1 or better — the addon manager in Beauti under the menu File/Mange add-ons will show which version you have installed.

There is an small example file “examples/testDiscreteSmall.xml” that is installed with BEAST-classic v1.1.1.

It is probably easiest to start creating an XML file using BEAUti by adding a discrete trait (See Ancestral reconstruction/Discrete phylogeography tutorial for details).

Then, you need to edit the XML, and

1. add a LeaftTrait to the AncestralStateTreeLikelihood, for example in testDiscreteSmall.xml


2. add a state-node to the state. In testDiscreteSmall.xml:


3. add an operator to sample the trait:


Note that the chicken_indices element shows the values that the trait is allowed to take. In this case, only 0 and 2, and state 1 is never sampled. These states coincide with the states defined for the location data type

   Hebei = 0,
   HongKong = 1,
   Guangdong = 2

Leave a Reply

Skip to toolbar