Learn R Programming

aphylo (version 0.3-3)

aphylo-model: Formulas in aphylo

Description

This function the the workhorse behind the likelihood function. It creates arbitrary models by modifying the call to LogLike() function according to what the user specifies as model.

Usage

eta(..., env)

psi(..., env)

Pi(..., env)

mu_d(..., env)

mu_s(..., env)

aphylo_formula(fm, params, priors, env = parent.frame())

Value

A list with the following elements:

  • fun A function. The log-likelihood function.

  • fixed Logical vector.

Arguments

...

Either 0, 1 or both. Depending on the parameter, the index of the model parameter that will be set as fixed.

env

Environment (not to be called by the user).

fm

A formula. Model of the type <aphylo-object> ~ <parameters> (see examples).

params

Numeric vector with model parameters.

priors

(optional) A function. Prior for the model.

Examples

Run this code
set.seed(12)
x <- raphylo(10)

# Baseline model
aphylo_formula(x ~ mu_d)

# Mislabeling probabilities
aphylo_formula(x ~ mu_d + psi)

# Different probabilities for speciation and duplication node
# (only works if you have both types)
aphylo_formula(x ~ mu_d + mu_s + psi)

# Mislabeling probabilities and etas(fixed)
aphylo_formula(x ~ mu_d + psi + eta(0, 1))

# Mislabeling probabilities and Pi 
aphylo_formula(x ~ mu_d + psi + Pi)

Run the code above in your browser using DataLab