dnCoalescentSkyline
- Heterochonous and homochronous skyline Coalescent process
theta : | RealPos[] (pass by const reference) |
A vector of per interval population sizes. | |
times : | RealPos[] (pass by const reference) |
A vector of times for the intervals, if applicable. | |
Default : NULL | |
events_per_interval : | Natural[] (pass by const reference) |
A vector of number of coalescent events for the intervals, if applicable. | |
Default : NULL | |
method : | String (pass by value) |
The method how intervals are defined. | |
Default : events | |
Options : events|specified | |
model : | String (pass by value) |
The demographic model for the intervals. | |
Default : constant | |
Options : constant|linear | |
taxa : | Taxon[] (pass by value) |
The taxa used when drawing a random tree. | |
constraints : | Clade[] (pass by value) |
The strictly enforced topology constraints. | |
Default : [ ] |
NUM_INTERVALS = ceil(n_taxa / 5)
for (i in 1:NUM_INTERVALS) {
pop_size[i] ~ dnUniform(0,1E6)
pop_size[i].setValue(100.0)
moves.append( mvScale(pop_size[i], lambda=0.1, tune=true, weight=2.0) )
}
# next we specify a prior on the number of events per interval
# we use a multinomial prior offset to have at least one event per interval
# first, specify the offset
num_events_pi <- rep(1, NUM_INTERVALS)
# next, specify the prior for the multinomial distribution
num_e_simplex_init <- rep(1, NUM_INTERVALS)
num_e_simplex <- simplex(num_e_simplex_init)
# calculate the number of coalescent events that we distribute over the intervals
n_multi <- n_taxa-1-NUM_INTERVALS
# draw the coalescent events into intervals
number_events_pi ~ dnMultinomial(p=num_e_simplex, size=n_multi)
# compute the actual number of events per interval, so the drawn number plus offset
final_number_events_pi := num_events_pi + number_events_pi
moves.append( mvIidPrior(x=number_events_pi) )
### the time tree is a stochastic node modeled by the constant-rate coalescent process (dnCoalescent)
psi ~ dnCoalescentSkyline(theta=pop_size, events_per_interval=final_number_events_pi, method="events", taxa=taxa)
interval_times := psi.getIntervalAges()
root_height := psi.rootAge()
# continue as usual to either clamp the genealogy or infer the genealogy based on sequence data