OUwie.fixed: Generalized Hansen model likelihood calculator

View source: R/OUwie.fixed.R

OUwie.fixedR Documentation

Generalized Hansen model likelihood calculator


Allows the user to calculate the likelihood given a specified set of parameter values


OUwie.fixed(phy, data, model=c("BM1","BMS","OU1","OUM","OUMV","OUMA","OUMVA"), 
simmap.tree=FALSE, root.age=NULL, scaleHeight=FALSE, root.station=FALSE, 
get.root.theta=FALSE, shift.point=0.5, alpha=NULL, sigma.sq=NULL, theta=NULL, 
clade=NULL, mserr="none", check.identify=TRUE, algorithm=c("invert", "three.point"), 
tip.paths=NULL, quiet=FALSE)



a phylogenetic tree, in ape “phylo” format and with internal nodes labeled denoting the ancestral selective regimes


a dataframe containing species information (see Details)


models to fit to comparative data (see Details).


a logical indicating whether the input tree is in SIMMAP format. The default is FALSE.


indicates the age of the tree. This is to be used in cases where the "tips" are not contemporary, such as in cases for fossil trees. Default is NULL meaning latest tip is modern day.


a logical indicating whether the total tree height should be scaled to 1 (see Details). The default is FALSE.


a logical indicating whether the starting state, theta_0, should be estimated.


a logical indicating whether the starting state, theta_0, should be estimated (see Details).


the point along a branch where a regime change is assumed to have occurred (if SIMMAP=FALSE. The default is set to 0.5, or halfway along a branch.


a numeric vector giving the values of alpha for each selective regime


a numeric vector giving the values of sigma^2 for each selective regime


a numeric vector giving the values of theta for each selective regime


a list containing a pair of taxa whose MRCA is the clade of interest.


designates whether a fourth column in the data matrix contains measurement error for each species value ("known"). The measurement error is assumed to be the standard error of the species mean. The default is "none".


a logical indicating whether to check that the user-supplied regime paintings will produce identifiable theta estimates. The default is TRUE.


designates whether the standard matrix inversion ('invert') or the faster 'three-point' algorithm of Ho and Ane (2013) should be used.


an optional list that can be provided by the user where each element from 1:nTips is the path from tip to root by labeled node number. The default is NULL and this option is used for internal speedups.


a logical indicating whether or not to print progress to the screen. The default is "FALSE".


The input is a tree and a data file. The tree must be of class “phylo” and must contain the ancestral selective regimes as internal node labels. The data file is a data.frame that must have column entries in the following order: [,1] species names and [,2] their current selective regime. The user specifies the parameter values (i.e. alpha, sigma^2, and theta).


OUwie.fixed returns an object of class OUwie.fixed. This is a list with elements:


the maximum log-likelihood.


Akaike information criterion.


Akaike information criterion corrected for sample-size.


Schwartz information criterion.


The model being fit


The number of parameters counted in the model.


a matrix containing the maximum likelihood estimates of alpha and sigma^2.


a matrix containing the maximum likelihood estimates of theta.


A vector of names for the different regimes


The indices of the parameters being estimated are returned. The numbers correspond to the row in the eigvect and can useful for identifying the parameters that are causing the objective function to be at a saddlepoint (see Details)


A logical indicating whether the input phylogeny is a SIMMAP formatted tree.


The user-supplied age at the root of the tree.


The user-specified portion of the branch where a regime shift occurs.


User-supplied dataset


User-supplied tree


A logical indicating whether the starting state, theta_0, was estimated


Indicates whether the tree was constrained to a total height of 1.


Indicates whether the root.theta was included in the model.


A table containing parameter estimates and the weights for time spent in each regime for each tip.


The algorithm used to estimate parameters.


Jeremy M. Beaulieu



#Calculate the likelihood based on known values of
#alpha, sigma^2, and theta:

OUwie.fixed(tree,trait,model=c("OUMVA"), simmap.tree=FALSE, scaleHeight=FALSE,
clade=NULL, alpha=alpha,sigma.sq=sigma.sq,theta=theta, algorithm="three.point")

OUwie documentation built on June 15, 2022, 5:15 p.m.