bayou.makeMCMC: Revision of bayou.mcmc that only makes the mcmc loop...

View source: R/bayou-mcmc.R

bayou.makeMCMCR Documentation

Revision of bayou.mcmc that only makes the mcmc loop function, rather than running it itself.

Description

Runs a reversible-jump Markov chain Monte Carlo on continuous phenotypic data on a phylogeny, sampling possible shift locations and shift magnitudes, and shift numbers.

Usage

bayou.makeMCMC(
  tree,
  dat,
  pred = NULL,
  SE = 0,
  model = "OU",
  prior,
  samp = 10,
  chunk = 100,
  control = NULL,
  tuning = NULL,
  file.dir = tempdir(),
  plot.freq = 500,
  outname = "bayou",
  plot.fn = phenogram,
  ticker.freq = 1000,
  startpar = NULL,
  moves = NULL,
  control.weights = NULL,
  lik.fn = NULL,
  perform.checks = TRUE
)

Arguments

tree

a phylogenetic tree of class 'phylo'

dat

a named vector of continuous trait values matching the tips in tree

pred

A matrix or data frame with named columns with predictor data represented in the specified formula

SE

The standard error of the data. Either a single value applied to all the data, or a vector of length(dat).

model

The parameterization of the OU model used. Either "OU" for standard parameterization with alpha and sigma^2; "OUrepar" for phylogenetic half-life and stationary variance (Vy), or "QG" for the Lande model, with parameters h^2 (heritability), P (phenotypic variance), omega^2 (width of adaptive landscape), and Ne (effective population size)

prior

A prior function of class 'priorFn' that gives the prior distribution of all parameters

samp

The frequency at which Markov samples are retained

chunk

The number of samples retained in memory before being written to a file

control

A list providing a control object governing how often and which proposals are used

tuning

A named vector that governs how liberal or conservative proposals are that equals the number of proposal mechanisms.

file.dir

If a character string, then results are written to that working directory. If NULL, then results are not saved to files, but instead held in memory. Default is 'tempdir()', which writes to an R temporary directory.

plot.freq

How often plots should be made during the mcmc. If NULL, then plots are not produced

outname

The prefix given to files created by the mcmc

plot.fn

Function used in plotting, defaults to phytools::phenogram

ticker.freq

How often a summary log should be printed to the screen

startpar

A list with the starting parameters for the mcmc. If NULL, starting parameters are simulated from the prior distribution

moves

A named list providing the proposal functions to be used in the mcmc. Names correspond to the parameters to be modified in the parameter list. See 'details' for default values.

control.weights

A named vector providing the relative frequency each proposal mechanism is to be used during the mcmc

lik.fn

Likelihood function to be evaluated. Defaults to bayou.lik.

perform.checks

A logical indicating whether to use bayou.checkModel to validate model inputs.

Details

By default, the alpha, sig2 (and various reparameterizations of these parameters) are adjusted with multiplier proposals, theta are adjusted with sliding window proposals, and the number of shifts is adjusted by splitting and merging, as well as sliding the shifts both within and between branches. Allowed shift locations are specified by the prior function (see make.prior()).


uyedaj/bayou documentation built on Jan. 28, 2024, 5:09 a.m.