coalescent.log.likelihood: Compute the likelihood of a gene genealogy conditonal on a...

Description Usage Arguments Details Value Author(s) References See Also

View source: R/rcolgem.R

Description

The likelihood of a dated tree is calculated conditional on a demographic history, which consists of the timeseries of births, migrations, and population sizes in the population.

Usage

1
2
3
4
coalescent.log.likelihood( bdt, births, deaths, nonDemeDynamics
   ,  t0, x0,  migrations=NA,  parms=NA, fgyResolution = 2000
   , integrationMethod = 'rk4',  censorAtHeight=FALSE
   , forgiveAgtY=.2, returnTree=FALSE)

Arguments

bdt

A binaryDatedTree object which extends ape:phylo and includes dates of tips and internal nodes.

births

A vector or matrix of strings. These are evaluated as equations for the number of births within and between demes. Must have rownames and colnames corresponding to the names of demes.

deaths

A vector of strings. These are evaluated as equations for the rate that lineages in each deme are terminated. Must have rownames corresponding to the names of demes.

nonDemeDynamics

A vector of strings. These are evaluated as equations for the rate of change of state variables that do not correspond to demes. Vector must have names of state variables.

t0

The time of origin of the process. Should be before root of genealogy.

x0

A vector of initial conditions for the demographic process (the state of the system at time t0). Should include the name and value of all variables mentioned in births and nonDemeDynamics.

migrations

A vector or matrix of strings. These are evaluated as equations for the number of migrations between demes. Must have rownames and colnames corresponding to the names of demes. Should be omitted if there is only one deme.

parms

A list of parameters that will be accessible to differential equations specified in births, migrations and nonDemeDynamics.

fgyResolution

Determines timestep of ODEs (larger values gives smaller time step)

integrationMethod

Passed to lsoda. Higher precision may be obtained with methods such as adams at some computational cost.

censorAtHeight

Boolean or numeric. If numeric, will ignore all parts of the tree older than this value when calculating the likelihood.

forgiveAgtY

If this is zero, function will return -Inf if at any point the number of lineages exceeds population size. If this value is between zero and one, function will return -Inf if the number of lineages exceeds population size AND number of lineages is less than this value times sample size. This can be useful when fitting models where the number of lineages is close to population size, which often happens during early period of exponential growth.

returnTree

If TRUE, the return value is a list with two elements. The first element is the log likelihood, and the second element is a modified version of the binaryDatedTree that includes the estimated ancestral states along each lineage. Ancestral state information is contained in the matrices lstates and ustates, which has the same number of rows as the tree edge attribute. These respectively describe the state at the beginning and end of each edge (present to past).

Details

See vignettes for detailed usage.

Value

The log likelihood (numeric).

Author(s)

Erik M Volz

References

E. M. Volz, Complex population dynamics and the coalescent under neutrality, Genetics, January, 2012

See Also

binaryDatedTree


rcolgem documentation built on May 2, 2019, 5:28 p.m.