loglik.tree: log-likelihood of a phylogenetic tree

Description Usage Arguments Value Author(s) Examples

View source: R/likelihood_functions.R

Description

it calculates the log-likelihood of a phylogenetic tree under the diversity-dependance model.

Usage

1
llik(pars, tree)

Arguments

pars

Parameters corresponding to the diversity-dependance model

tree

phylogenetic tree described as the three vectors wt,E and n.

Value

log-likelihood value

Author(s)

F. Richter M.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
##   compare log likelihoods 

#dd
tree = data.frame(brts=c(2,3,5,6),to=c(1,0,2,2),t_ext=c(3,Inf,Inf,Inf))
tree$n = sapply(tree$brts,n_from_time,tree=tree,soc=2)
pars = c(0.2,0.6,-0.005)
loglik.tree.rpd1(pars,tree)

loglik.tree.numerical(pars,tree,"rpd1")


## pd
tree$pd <- sapply(tree$brts, phylodiversity, tree=tree,soc=2)
pars = c(0.2,0.6,-0.01,0.01)
loglik.tree.rpd5c(pars,tree)
loglik.tree.numerical(pars,tree,"rpd5c")

franciscorichter/emphasisR documentation built on Dec. 20, 2021, 8:50 a.m.