This function computes the log-likelihood of the chosen parameters given a particular dataset. The arguments annotations, and offspring should be as those returned by new_aphylo(). For complete parameter estimation see aphylo_estimates.

LogLike(tree, psi, mu_d, mu_s, eta, Pi, verb_ans = TRUE, check_dims = TRUE)

Arguments

tree

A phylogenetic tree of class aphylo.

psi

Numeric vector of length 2. Misclasification probabilities. (see LogLike).

mu_d, mu_s

Numeric vector of length 2. Gain/loss probabilities (see LogLike).

eta

Numeric vector of length 2. Annotation bias probabilities (see LogLike).

Pi

Numeric scalar. Root node probability of having the function (see LogLike).

verb_ans

Logical scalar. When FALSE (default) the function returns a list with a single scalar (the log-likelihood).

check_dims

Logical scalar. When TRUE (default) the function checks the dimmension of the passed parameters.

Value

A list of class phylo_LogLik with the following elements:

S

An integer matrix of size \(2^p\times p\) as returned by states.

Pr

A numeric matrix of size \(G\times 2^p\) with node/state probabilities.

ll

A numeric scalar with the log-likelihood value given the chosen parameters.

Details

The parameters to estimate are described as follows:

  1. psi: A vector of length 2 with \(\psi_0\) and \(\psi_1\), which are the misclassification probabilities fo \(s_p=0\) and \(s_p=1\) respectively.

  2. mu_d, mu_s: A vector of length 2 with \(\mu_0\) and \(\mu_1\) which are the gain and loss probabilities respectively. The subscript d denotes duplication nodes and s speciation node.

  3. eta: A vector of length 2 with \(\eta_0\) and \(\eta_1\) which are the annotation bias probabilities.

  4. Pi: A numeric scalar which for which equals the probability of the root node having the function.