Skip to contents

Conditional likelihoods combine by postorder traversal (L_s(k) = prod_children sum_j P_sj(v) L_j(child)); site likelihood L = sum_s pi_s L_s(root); substitution P_ij(t) = e^{-t} delta_ij + (1 - e^{-t}) pi_j.

Usage

morie_felsen(tree, sites, pi = NULL)

Arguments

tree

Nested list: leaf = taxon name (character); internal node = list of list(child, branch_length) pairs.

sites

List of named lists {taxon = base}.

pi

Stationary base frequencies (default uniform).

Value

A list with elements loglik, site_likelihoods, n_sites, pi, method.

References

Felsenstein, J. (1981). Evolutionary trees from DNA sequences: a maximum likelihood approach. Journal of Molecular Evolution, 17(6), 368-376.

Examples

tree <- list(list("A", 0.1), list(list(list("B", 0.2), list("C", 0.2)), 0.1))
sites <- list(list(A = "A", B = "A", C = "G"), list(A = "C", B = "C", C = "C"))
morie_felsen(tree, sites)$loglik
#> [1] -6.540524