OU1d.loglik: Log likelihood of an one-dimensional Ornstein-Uhlenbeck model

View source: R/OU1d.R

OU1d.loglikR Documentation

Log likelihood of an one-dimensional Ornstein-Uhlenbeck model

Description

computes log likelihood of an one-dimensional Ornstein-Uhlenbeck model with an algorithm that is linear in the number of tips in the tree.

Usage

OU1d.loglik(trait, phy, model = c("OUrandomRoot", "OUfixedRoot"), parameters = NULL)

Arguments

trait

a vector of trait values.

phy

a phylogenetic tree of type phylo with branch lengths.

model

an Ornstein-Uhlenbeck model.

parameters

List of parameters for the model

Author(s)

Lam Si Tung Ho

Examples

tr = rtree(100)
alpha = 1
sigma2 = 1
sigma2_error = 0.5
ancestral.state = 0
optimal.value = 1
  
trait = rTrait(n = 1, tr, model = "OU", 
              parameters = list(ancestral.state=ancestral.state, alpha=alpha,
                                sigma2=sigma2,sigma2_error=sigma2_error,
                                optimal.value=optimal.value))
OU1d.loglik(trait=trait, phy=tr, model="OUfixedRoot", 
            parameters=list(ancestral.state=ancestral.state, alpha=alpha,sigma2=sigma2,
                            sigma2_error=sigma2_error,optimal.value=optimal.value))

phylolm documentation built on Oct. 1, 2024, 1:09 a.m.