geniefit: A function to fit coalescent models to a given phylogenetic...

Description Usage Arguments Value Author(s) References Examples

View source: R/Geniefit.R

Description

This function fits a user chosen coalescent model to fit a given phylogenetic tree by maximum likelihood estimation or Markov Chain Monte Carlo (MCMC) inference.

Coalescent theory describes the mathematical properties of intra-population phylogenies (Kingman (1982)). Griffiths and Tavare (1994) suggests a particular coalescent model, which describes how the shape of the genealogy depends on the demograhic history of the sampled population. It provides a probability distribution for the waiting times between coalescent events in a genealogy. This distribution depends on the demographic function N_e(t), which is the effective population size at time t before present. Pybus and Rambaut (2002) represents the demographic function using simple mathematical functions that characterize biologically plausible population dynamic histories, such as constant, exponential, logistic, expension, piecewise constant, piecewise expansion, and piecewise logistic growth.

Usage

1
2
geniefit(phy, Model, start, upper, lower, Rcpp = F, MCMC = F, sig = 0.1,
  run = 10000)

Arguments

phy

A phylogenetic tree, which is an object of class "phylo".

Model

A model choice from const (constant population size), expo (exponetial growth),expan (expansion growth), log (logistic growth), step (piecewise constant), pexpan (piecewise expansion growth) and plog (piecewise logistic growth).

start

A numeric vector of starting estimates of the parameters of the coalescent model.

upper

A numeric vector of upper bounds on the parameters. If the length is 1 the single upper bound is applied to all parameters.

lower

A numeric vector of lower bounds on the parameters. If the length is 1 the single lower bound is applied to all parameters.

Rcpp

Calculation is based on C++ code when it is True and on R code when it is False.

MCMC

MCMC simulation is run when it is true, and not run when it is False. The default prior is uniform given the lower and upper.

sig

MCMC simulation step size.

run

Number of MCMC simulation.

Value

Parameters estimation of a given model, loglikelihood and AIC, when MCMC=F and additional MCMC simulations for parameters and loglikelihood will be presented when MCMC=T.

Author(s)

Fei Xiang (xf3087@gmail.com)

References

Kingman, J. F. C. (1982). On the Genealogy of Large Populations. Journal of Applied Probability 19, 27-43.

Griffiths, R., and Tavare, S. (1994). Sampling Theory for Neutral Alleles in a Varying Environment. Philosophical Transactions: Biological Sciences, 344(1310), 403-410.

Pybus, O. G., and Rambaut, A. (2002). GENIE: Estimating Demographic History from Molecular Phylogenies. Bioinformatics 18, 1404-1405.

Examples

1
2
3
4
5
6
7
library(ape)
t1=rcoal(20)
geniefit(t1,Model="expo",start=c(100,.1),upper=Inf,lower=0)
geniefit(t1,Model="expo",start=c(100,.1),upper=Inf,lower=0,Rcpp=T)
###a MCMC simulation included##
f=geniefit(t1,Model="expo",start=c(100,.1),upper=Inf,lower=0,MCMC=T,sig=.1,run=10000)
acf(f$MCMC.simulation)

xiangfstats/GenieR documentation built on May 4, 2019, 1:06 p.m.