colik | R Documentation |
Computes the log likelihood using a coalescent (or structured coalescent) genealogical model based on a user-supplied demographic process.
colik(
tree,
theta,
demographic.process.model,
x0,
t0,
res = 1000,
integrationMethod = "lsoda",
timeOfOriginBoundaryCondition = TRUE,
maxHeight = Inf,
forgiveAgtY = 1,
AgtY_penalty = 1,
returnTree = FALSE,
step_size_res = 10,
likelihood = c("PL2", "PL1", "QL"),
PL2 = FALSE
)
tree |
A DatedTree object |
theta |
A named numeric vector or named list of parameter values used by the demographic model |
demographic.process.model |
See |
x0 |
A named vector of initial conditions required by the model. This includes demes and any other dynamic variables. |
t0 |
The time of origin of the process. Should predate the root of the tree. |
res |
Integer number of time steps to use when simulating model. |
integrationMethod |
If simulating an ODE model, this provides the integration routine corresponding to options in deSolve. |
timeOfOriginBoundaryCondition |
If TRUE, will return -Inf if the root of the tree precedes the time of origin. |
maxHeight |
Will only count internode intervals in the likelihood that occur after maxHeight years before present. Useful for large trees and when you don't want to model the entire demographic history. |
forgiveAgtY |
If number of extant lineages exceeds simulated population size, return -Inf if this value is zero, or forgive the discrepancy if zero. If between zero and one, only forgive the discrepancy if this proportion of lineages is less than the given value. |
AgtY_penalty |
If number of extant lineages exceeds simulated population size, penalise likelihood with value L*AgtY_penalty where L is the cumulative coalescent rate within the given internode interval. 0<= AgtY_penalty <= Inf. |
returnTree |
If TRUE, a copy of the tree is also returned, which includes the inferred states of lineages and likelihood terms at each internal node. |
step_size_res |
Parameter for the ODE solver; it is the default number of timesteps to use when solving coalescent equations in each internode interval |
likelihood |
Toggle likelihood approximation to be used (QL fast/approximate, PL1 faster better approximation, PL2 slow/good approximation. See Volz & Siveroni 2018 for details. |
The coalescent (or structured coalescent) log likelihood (numeric).
Erik Volz
# A simple exponential growth model with birth rates beta and death rates gamma:
dm <- build.demographic.process(births=c(I = 'parms$beta * I'),
deaths = c(I = 'parms$gamma * I'),
parameterNames=c('beta', 'gamma'),
rcpp=FALSE,
sde=FALSE)
# simulate a tree based on the model:
tre <- sim.co.tree(list(beta = 1.5, gamma = 1),
dm,
x0 = c(I = 1),
t0 = 0,
sampleTimes = seq(10, 15, length.out=50),
res = 1000)
# Compute a likelihood
colik(tre,
list(beta = 1.5, gamma = 1),
dm,
x0 = c(I = 1),
t0 = -1,
res = 1e3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.