hansen {ouch} | R Documentation |
Fits the Ornstein-Uhlenbeck-based Hansen model to data.
The fitting is done using optim
.
hansen(data, tree, regimes, alpha, sigma, fit = TRUE, method = c("Nelder-Mead","subplex","BFGS","L-BFGS-B"), hessian = FALSE, ...)
data |
Phenotypic data for extant species, i.e., at the terminal twigs of the phylogenetic tree.
This can either be a single numeric vector or a list (or data-frame) containing nchar vectors (columns) of data.
|
tree |
A phylogenetic tree, specified as an ouchtree object.
|
regimes |
A vector of codes, one for each node in the tree, specifying the selective regimes hypothesized to have been operative.
Corresponding to each node, enter the code of the regime hypothesized for the branch segment terminating in that node.
For the root node, because it has no branch segment terminating on it, the regime specification is irrelevant.
If there are nchar quantitative characters (i.e., if data is a list with nchar columns), then regimes should be a list length 1 or nchar .
|
alpha |
An initial guess of the selection strength parameters alpha.
This is used to initialize the optimization algorithm.
This vector will be translated into a symmetric matrix by the function given in alpha.fn .
|
sigma |
An initial guess of the random drift parameters sigma, used to initialize the optimization algorithm.
This vector is translated into a lower-triangular matrix by the function sigma.fn .
|
fit |
If fit=TRUE , then the likelihood will be maximized.
If fit=FALSE , the likelihood will be evaluated at the specified values of alpha and sigma ; the optima theta will be returned as well.
|
method |
The method to be used by the optimization algorithm, optim .
See subplex and optim for information on the available options.
|
hessian |
If hessian=TRUE , then the Hessian matrix will be computed by optim .
|
... |
Additional arguments will be passed as control options to optim or subplex .
See optim and subplex for information on the available options.
|
hansen
returns an object of class hansentree
.
For details on the methods of that class, see hansentree
.
Aaron A. King <kingaa at umich dot edu>
Butler, M.A. and A.A. King (2004) Phylogenetic comparative analysis: a modeling approach for adaptive evolution. American Naturalist 164:683-695.