Learn R Programming

rase (version 0.2-22)

point.like.bm: n-dimensional Maximum Likelihood of Point Brownian Motion

Description

Estimates Most Recent Common Ancestor (MRCA) states and the Brownian rate according to a Brownian Motion model of trait evolution using Maximum Likelihood. It can be used for several dimensions simultaneously. For 1-dimensional traits, we recommend the more stable ace function.

Usage

point.like.bm(tree, values, start_values = NA, dimen = NA)

Arguments

tree
phylogenetic tree of class "phylo".
values
a list, with each element being one-dimensional values for one trait.
start_values
Optional. A vector of starting values for the Maximum Likelihood optimization. The funtion only estimates the MRCA and the rates for each trait, and that should be the order of the input starting values.
dimen
Optional. Number of dimensions (number of traits being analyzed). If dimen = NA, dimensions are obtained from values.

Value

Returns a list with the following components:
mrcas
Most recent common ancestor estimates for each trait (in the same order of the input values).
rates
Brownian motion rate parameters for each trait(in the same order of the input values).
nlm.details
A list with the results from nlm optimization. For details see nlm.

References

Schluter, D., et al. 1997 Likelihood of ancestor states in adaptive radiation. Evolution: 1699-1711.

See Also

ace, ML taking into account ranges ranges.like.bm.

Examples

Run this code
# Number of taxa to simulate tree
# Number of taxa
ntaxa <- 10

# Known parameters
mean_x <- 0
mean_y <- 0
sigma_x <- 1 
sigma_y <- 1

# Create a random tree
tree <- ape::rtree(n = ntaxa)

# Create random data according to tree structure
x_locs <- as.numeric(mvtnorm::rmvnorm(1, rep(mean_x,ntaxa), sigma=sigma_x*vcv(tree)))
y_locs <- as.numeric(mvtnorm::rmvnorm(1, rep(mean_y,ntaxa), sigma=sigma_y*vcv(tree)))
values <- list(x_locs,y_locs)

## Not run: 
# # run point.like.bm
# bm_results = point.like.bm(tree, values)## End(Not run)

Run the code above in your browser using DataLab