Traits evolving on a tree
A trait evolves along the branches of a phylogeny. It starts at the root and wanders down each branch, and at every split both daughter lineages carry the value on and wander independently from there. Sister species resemble each other because they share history, and how much the tips spread, and how much they still share, depends on the model of change. Press play to watch it happen.
1 One trait through time
Each branch draws its own random path, starting where its parent ended. Under Brownian motion the spread of a lineage grows with the square root of time and the tips' covariance is the time they shared. A trend adds a steady drift. An Ornstein–Uhlenbeck pull draws every lineage toward an optimum θ, so the spread levels off and old history is forgotten. In an early burst the rate falls over time, so most change happens among the first lineages; in a late burst it rises. A burst partway through raises the rate for a while and lets it decay. And a clade can shift to an optimum of its own.
The rate through time
Each draw uses the same random steps under every model, so switching models shows what the model alone changes.
2 Two traits through time
Two traits, such as a height and a width, evolving together. Within a lineage their changes are correlated by the rate matrix; across species they also covary because the species shared history. Here each lineage is a path through trait 1, trait 2 and time, with time running up, and its shadows on the back walls show each trait on its own against time.
3 Filling in a branch
Suppose the trait's values at both ends of a branch are known, and only what happened in between is not. Under Brownian motion the path between two fixed ends is a Brownian bridge, and it can be drawn one midpoint at a time: the point halfway between two known points is normal, centred between them, with a variance a quarter of their span times the rate. Each level of refinement halves the gaps. Keeping the path inside a region, say an island it cannot leave, is harder, and redrawing individual midpoints is only approximate.
How it works
Simulating
A pure-birth (Yule) tree grows as phytools' pbtree does: two lineages leave the root, each waits an exponential time to split, and after the last split the tips grow for one more wait; it is then scaled to height 1. A pasted Newick tree is used as written, in its own units, its root edge included as a stem. Each branch is cut into steps, about the tree's height divided by the steps, and each step is drawn from the model's exact transition: normal, with the mean and variance the model gives over that step. So the steps change how detailed the picture is, not how the tips are distributed. Draws come with a seed, so a seed gives the same tree and paths for the same settings. The API provides the same computations.
The models
Brownian motion has variance σ² per unit time. A trend adds a drift μ per unit time to the mean. Ornstein–Uhlenbeck moves the mean toward θ at rate α, θ + (x − θ)e−αt, with variance σ²(1 − e−2αt)/2α, so a lineage's spread levels off at σ²/2α. The burst models change σ² with time: σ²eat for an early (a < 0) or late (a > 0) burst, and σ²(1 + δ²e−λ(t − tb)) after a burst at tb. A clade shift is Ornstein–Uhlenbeck with a second optimum on the clade's branches, its stem included.
The bridge
Between fixed points a at time s and b at time u, Brownian motion with rate matrix R passes the midpoint time at a normal point with mean (a + b)/2 and covariance (u − s)R/4. The midpoint method draws these points level by level and redraws any that falls outside the region. That is an approximation: it conditions each new point on the region but not the rest of the path, which lets paths crowd the region's edge. Redrawing whole paths until one stays inside is exact for the drawn points, and this page shows how far apart the two come out.