Learn R Programming

OUwie (version 1.50)

OUwie.fixed: Generalized Hansen model likelihood calculator

Description

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

Usage

OUwie.fixed(phy, data, model=c("BM1","BMS","OU1","OUM","OUMV","OUMA","OUMVA"), 
simmap.tree=FALSE, root.age=NULL, scaleHeight=FALSE, root.station=TRUE, alpha=NULL, 
sigma.sq=NULL, theta=NULL, clade=NULL, mserr="none", quiet=FALSE)

Arguments

phy

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

data

a dataframe containing species information (see Details)

model

models to fit to comparative data (see Details).

simmap.tree

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

root.age

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.

scaleHeight

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

root.station

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

alpha

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

sigma.sq

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

theta

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

clade

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

mserr

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".

quiet

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

Value

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

$loglik

the maximum log-likelihood.

$AIC

Akaike information criterion.

$AICc

Akaike information criterion corrected for sample-size.

$model

The model being fit

$param.count

The number of parameters counted in the model.

$solution

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

$theta

a matrix containing the maximum likelihood estimates of \(\theta\).

$tot.state

A vector of names for the different regimes

$index.mat

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)

$simmap.tree

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

$root.age

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

$data

User-supplied dataset

$phy

User-supplied tree

$root.station

A logical indicating whether the starting state, \(\theta_0\), was estimated

$res

A vector of residuals from the model fit. The residuals are ordered in the same way as the tips in the tree.

Details

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\)).

Examples

Run this code
# NOT RUN {
data(tworegime)

#Calculate the likelihood based on known values of
#alpha, sigma^2, and theta:
alpha=c(0.5632459,0.1726052)
sigma.sq=c(0.1064417,0.3461386)
theta=c(1.678196,0.4185894)

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

Run the code above in your browser using DataLab