OU.lik: Function for calculating likelihood of an OU model in bayou...

View source: R/bayou-likelihood.R

OU.likR Documentation

Function for calculating likelihood of an OU model in bayou using pruning algorithm or matrix inversion

Description

Function for calculating likelihood of an OU model in bayou using pruning algorithm or matrix inversion

Usage

OU.lik(pars, tree, X, SE = 0, model = "OU", invert = FALSE)

Arguments

pars

A list of parameters to calculate the likelihood

tree

A phylogenetic tree of class 'phylo'

X

A named vector giving the tip data

SE

A named vector or single number giving the standard errors of the data

model

Parameterization of the OU model. Either "OU", "QG" or "OUrepar".

invert

A logical indicating whether the likelihood should be solved by matrix inversion, rather than the pruning algorithm. This is primarily present to test that calculation of the likelihood is correct.

Details

This function can be used for calculating single likelihoods using previously implemented methods. It is likely to become deprecated and replaced by bayou.lik in the future, which is based on phylolm's threepoint algorithm, which works on non-ultrametric trees and is substantially faster.

Value

A list returning the log likelihood ("loglik"), the weight matrix ("W"), the optima ("theta"), the residuals ("resid") and the expected values ("Exp").


uyedaj/bayou documentation built on Jan. 28, 2024, 5:09 a.m.