transformPhylo.MCMC: Bayesian MCMC for models of trait evolution

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/transformPhylo.MCMC.R

Description

Fits Bayesian models for various models of continuous character evolution using a Metropolis-Hastings Markov Chain Monte Carlo (MCMC) approach

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
transformPhylo.MCMC(
  y,
  phy,
  model,
  mcmc.iteration = 1000,
  burn.in = 0.1,
  hiddenSpeciation = FALSE,
  full.phy = NULL,
  lowerBound = NULL,
  upperBound = NULL,
  useMean = FALSE,
  random.start = TRUE,
  meserr = NULL,
  covPIC = TRUE,
  lambdaEst = FALSE,
  nodeIDs = NULL,
  branchLabels = NULL,
  acdcScalar = FALSE,
  sample.every = 10
)

Arguments

y

A matrix of trait values.

phy

An object of class phylo (see ape).

model

The model of trait evolution (see details).

mcmc.iteration

Integer - the number of generations for which to run the MCMC chain

burn.in

The proportion of the chain (as given by mcmc.iteration) which to discard as 'burn-in'

hiddenSpeciation

Logical. If TRUE the psi model will include nodes that are on the 'full.phy' but not the tree pruned of trait data

full.phy

The full phylogeny containing the species that do not contain trait data so are not included in 'phy'

lowerBound

Minimum value for parameter estimates

upperBound

Maximum value for parameter estimates

useMean

Logical. Use the branch-based estimates of extinction of mean (TRUE, default) for the "psi" and "multispi" models only applicable if "hiddenSpeciation" = TRUE

random.start

Use a random starting value for the MCMC run (TRUE), or use the environment set.seed() value

meserr

A vector (or matrix) of measurement error for each tip. This is only applicable to univariate analyses

covPIC

Logical. For multivariate analyses, allow for co-variance between traits rates (TRUE) or no covariance in trait rates (FALSE). If FALSE, only the trait variances not co-variances are used.

lambdaEst

Logical. Estimate lambda alongside parameter estimates to reduce data noise. Only applicable for models "kappa", "delta", "OU", "psi", "multispi", and "ACDC". Default=FALSE.

nodeIDs

Integer - ancestral nodes of clades applicable to rate heterogenous and nested models of evolution (see details)

branchLabels

Branches on which different psi parameters are estimated in the "multipsi" model

acdcScalar

Logical. For nested EB rate model, simultaneously estimated a rate scalar alongside EB model. Default=FALSE.

sample.every

Number specifying the every nth that is sampled in the MCMC chain (default = 1).

Details

The method estimates posterior probabilities using a Metropolis-Hastings MCMC approach that places a prior bounded uniform distribution on all parameters with an independence sampler. These prior distributions can be altered by changing the upperBound and lowerBound arguments. The MCMC model will estimate the posterior probability for the following models:

Value

median The median estimate of the posterior for the parameter

95.HPD The 95 percent Highest Posterior Density for the parameter

ESS Effective Sample Size for the posterior

acceptance.rate The ratio for which new proposals were accepted during the MCMC chain

mcmc.chain Full MCMC chain containing all iterations (including burn-in)

Author(s)

Mark Puttick, Gavin Thomas

See Also

transformPhylo.ML, transformPhylo.ll, transformPhylo

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(anolis.tree)
data(anolis.data)
attach(anolis.data)
male.length <- matrix(Male_SVL, dimnames=list(rownames(anolis.data)))
sortedData <- sortTraitData(anolis.tree, male.length)
phy <- sortedData$phy
male.length <- sortedData$trait
phy.clade <- extract.clade(phy, 182)
male.length.clade <- as.matrix(male.length[match(phy.clade$tip.label, rownames(male.length)),])
## please note, this model will be need to run for longer to achieve convergence
lambda.mcmc <- transformPhylo.MCMC(y=male.length.clade, phy=phy.clade, 
model="lambda", mcmc.iteration=100, burn.in=0.1)

PuttickMacroevolution/motmot documentation built on June 5, 2020, 7 p.m.