ancThresh: Ancestral character estimation under the threshold model...

View source: R/ancThresh.R

ancThreshR Documentation

Ancestral character estimation under the threshold model using Bayesian MCMC

Description

This function uses Bayesian MCMC to estimate ancestral states and thresholds for a discrete character under the threshold model from quantitative genetics (Felsenstein 2012).

Usage

ancThresh(tree, x, ngen=100000, sequence=NULL, method="mcmc", 
   model=c("BM","OU","lambda"), control=list(), ...)

Arguments

tree

phylogenetic tree.

x

a named vector containing discrete character states; or a matrix containing the tip species, in rows, and probabilities of being in each state, in columns.

ngen

number of generations to run the MCMC.

sequence

assumed ordering of the discrete character state. If not supplied and x is a vector then numerical/alphabetical order is assumed; if not supplied and x is a matrix, then the column order of x is used.

method

only method currently available is "mcmc".

model

model for the evolution of the liability. Options are "BM" (Brownian motion, the default), "OU" (Ornstein-Uhlenbeck), or "lambda" (the λ model).

control

list containing the following elements: sample, the sampling interval; propliab variance of the proposal distribution for liabilities; propthresh variance on the proposal distribution for the thresholds; propalpha variance on the proposal distribution for alpha (for model="OU"); pr.anc prior probability distribution on the ancestral states for each node, in a matrix - not all nodes need to be supplied; pr.th prior density on the thresholds; burnin number of generations to exclude for burn-in when plotting posterior probabilities on the tree; plot logical value indicating whether or not to plot the posterior probabilities; print logical value indicating whether or not to print the state of the MCMC; piecol colors for the posterior probabilities plotted as pie charts at internal nodes; and tipcol which indicates whether the tip colors should be based on the input data ("input") or sampled tip liabilities ("estimated"). These will only differ if there is uncertainty in the tip states.

...

additional arguments to be passed to plotThresh (called internally).

Details

print and plot S3 methods are now available for the object class "ancThresh".

Value

This function returns an object of class "ancThresh" containing the posterior sample from our analysis, although with other components.

Author(s)

Liam Revell liam.revell@umb.edu

References

Felsenstein, J. (2012) A comparative method for both discrete and continuous characters using the threshold model. American Naturalist, 179, 145-156.

Revell, L. J. (2014) Ancestral character estimation under the threshold model from quantitative genetics. Evolution, 68, 743-759.

See Also

anc.Bayes, threshBayes

Examples

## Not run: 
## load data from Revell & Collar (2009)
data(sunfish.tree)
data(sunfish.data)
## extract character of interest
fmode<-setNames(sunfish.data$feeding.mode,
    rownames(sunfish.data))
## run MCMC
mcmc<-ancThresh(sunfish.tree,fmode,ngen=1000000)
## plot results
plot(mcmc,mar=c(0.1,0.1,4.1,0.1))
title(main="Posterior probabilities for node states",
    font.main=3)
## End(Not run)

phytools documentation built on Sept. 2, 2022, 1:06 a.m.