Learn R Programming

aphylo (version 0.3-3)

APHYLO_DEFAULT_MCMC_CONTROL: Model estimation using Markov Chain Monte Carlo

Description

The function is a wrapper of fmcmc::MCMC().

Usage

APHYLO_DEFAULT_MCMC_CONTROL

aphylo_mcmc( model, params, priors = uprior(), control = list(), check_informative = getOption("aphylo_informative", FALSE), reduced_pseq = getOption("aphylo_reduce_pseq", TRUE) )

APHYLO_PARAM_DEFAULT

Value

An object of class aphylo_estimates.

Format

An object of class list of length 6.

An object of class numeric of length 9.

Arguments

model

A model as specified in aphylo-model.

params

A vector of length 7 with initial parameters. In particular psi[1], psi[2], mu[1], mu[2], eta[1], eta[2] and Pi.

priors

A function to be used as prior for the model (see bprior).

control

A list with parameters for the optimization method (see details).

check_informative

Logical scalar. When TRUE the algorithm stops with an error when the annotations are uninformative (either 0s or 1s).

reduced_pseq

Logical. When TRUE it will use a reduced peeling sequence in which it drops unannotated leafs. If the model includes eta this is set to FALSE.

Details

APHYLO_DEFAULT_MCMC_CONTROL lists the default values for the MCMC estimation:

  • nsteps: 1e4L

  • burnin: 5e3L

  • thin : 10L

  • nchains : 2L

  • multicore : FALSE

  • conv_checker : fmcmc::convergence_auto(5e3)

For more information about the MCMC estimation process, see fmcmc::MCMC().

Methods base::print(), base::summary(), stats::coef, stats::window(), stats::vcov(), stats::logLik(), predict(), and the various ways to query features of the trees via Ntip() are available post estimation.

The vector APHYLO_PARAM_DEFAULT lists the starting values for the parameters in the model. The current defaults are:

  • psi0: 0.10

  • psi1: 0.05

  • mu_d0: 0.90

  • mu_d1: 0.50

  • mu_s0: 0.10

  • mu_s1: 0.05

  • eta0: 1.00

  • eta1: 1.00

  • Pi: 0.50

See Also

Other parameter estimation: aphylo_mle()

Examples

Run this code
# Using the MCMC ------------------------------------------------------------

# \donttest{

set.seed(1233)
# Simulating a tree
tree <- sim_tree(200)

# Simulating functions
atree <- raphylo(
  tree = tree,
  psi  = c(.01, .03),
  mu_d = c(.05, .02),
  Pi   = .5
)

# Running the MCMC
set.seed(1231)

ans_mcmc <- aphylo_mcmc(
  atree ~ mu_d + psi + eta + Pi,
  control = list(nsteps = 2e5, burnin=1000, thin=200)
)
# }

Run the code above in your browser using DataLab