runBatchHansen: Analyze Ornstein-Uhlenbeck models over a set of trees

Description Usage Arguments Details Value Note Author(s) See Also


runBatchHansen estimates the support for character change on taxon-defined nodes, integrating over uncertainty in the phylogeny and the model of trait evolution.


runBatchHansen(ouchTrees, characterStates, cladeMembersList, filePrefix = NULL, 
               di = NULL, nodeNames = NULL, maxNodes = length(cladeMembersList), 
			   regimeTitles = NULL, brown = FALSE, ...)  



A list of ouchtree style trees, or a single tree


A vector of character states to analyze. As written, the function accepts a named vector, with names corresponding to tip names in the trees, a vector of length equal to the number of terminal branches, or a vector of length equal to the number of nodes in the trees


A list of tip-name vectors, each defining a node of interest in the tree. Because these vectors are checked for monophyly on each tree, each node must by defined by all tips descendent from that node


A file prefix for saving hansen objects. If left at default (NULL), no hansen objects will be saved. Typically this is fine, but if you want to extract parameters from individual hansen objects, or do any bootstrapping, it is helpful to save the individual analyses.


A directory in which to save hansen objects. Not required, but strongly recommended if you are saving hansen objects.


A vector of names for the nodes being analyzed. Not implemented.


The maximum number of nodes at which the regime is allowed to change. Defaults to the number of nodes specified.


Names for regimes; only enter if you know how many regimes you will be getting and have reason to name them. Optional.


Enter T or F according to whether you want to run the Brownian motion model.


Arguments passed along to hansen. As written now, sigma and alpha are set at 1 for the optimizer to begin with. Other arguments are described in documentation for hansen.


This function is the primary function for estimating the probability of a change in with changes in regime at the nodes specified, with changes corresponding to permutations of the nodes fed to the function. See vignette for additional details.


A list of class hansenBatch with the following items:


A matrix with rows equal to the number of models analyzed, and four columns: loglik = log-likelihood of the model; dof = number of free parameters in the model; sigma.squared = estimate of the variance parameter; theta / alpha = estimate of either the root character state (for the brownian motion model) or the alpha parameter (for Ornstein-Uhlenbeck models).


A list of vectors with a theta corresponding to each regime on the tree.


A list indexed by tree of lists indexed by model, with the regime corresponding to each model on each tree.


The nodes by regimes matrix returned by regimeMatrix at the outset of analysis.


A nodes by tree matrix, indicating for each tree which nodes are present.


A boolean vector of length one indicating whether the brownian motion model was fitted.


The sample size (number of terminals on the trees).


Data of analysis.


Verbatim call to runBatchHansen.


Summary estimates of the probability of change on a branch are only valid if (1) the maximum number of regimes permitted approximates the actual maximum; (2) nodes at which changes actually occurred were included among the nodes being tested; and (3) any matrix you may have utilized to conduct analysis was balanced, such that all nodes are present in the same number of models.


Andrew Hipp <>

See Also

summary.hansenBatch for summarizing data; carex for an example

Search within the maticce package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.