Learn R Programming

phytools (version 0.2-40)

anc.trend: Ancestral character estimation with a trend

Description

This function estimates the evolutionary parameters and ancestral states for Brownian evolution with directional trend.

Usage

anc.trend(tree, x, maxit=2000)

Arguments

tree
an object of class "phylo".
x
a vector of tip values for species; names(x) should be the species names.
maxit
an optional integer value indicating the maximum number of iterations for optimization.

Value

  • a list with the following components:
  • acea vector with the ancestral states.
  • mua trend parameter per unit time.
  • sig2the variance of the BM process.
  • logLthe log-likelihood.
  • convergencethe value of $convergence returned by optim() (0 is good).

Details

Note that this will generally only work and produce sensible results for a phylogeny with some non-contemporary tips (i.e., a tree with some fossil species). The function uses optim with method="L-BFGS-B"; however optimization is only constrained for the sig2 which must be >0.

See Also

ace, anc.Bayes, anc.ML, optim

Examples

Run this code
set.seed(10)
tree<-rtree(30)
x<-fastBM(tree,mu=2) # simulate using fastBM with a trend (m!=0)
anc.trend(tree,x) # fit model & estimate ancestral states

Run the code above in your browser using DataLab