llik.st: log-likelihood of a set of phylogenetic trees

Description Usage Arguments Examples

View source: R/llik.st.R

Description

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

Usage

1
llik.st(pars, setoftrees, impsam = F, correction = 0)

Arguments

pars
setoftrees
impsam
correction

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (pars, setoftrees, impsam = F, correction = 0)
{
    m = length(setoftrees)
    l = vector(mode = "numeric", length = m)
    w = vector(mode = "numeric", length = m)
    D = vector(mode = "numeric", length = m)
    for (i in 1:m) {
        s = setoftrees[[i]]
        l[i] = llik(pars = pars, tree = s) + length(s$tree$wt) *
            correction
        w[i] = s$weight
        D[i] = length(s$wt)
    }
    if (impsam) {
        weight = exp(w - correction * D)/sum(exp(w - correction *
            D))
        l = l * weight
    }
    L = sum(l)
    return(L)
  }

franciscorichter/dmea02 documentation built on March 21, 2020, 3:46 a.m.