transformPhylo.MCMC: Bayesian MCMC for models of trait evolution

Description Usage Arguments Details Value Author(s) 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
transformPhylo.MCMC(y, phy, model, mcmc.iteration = 1000, burn.in = 0.1,
  hiddenSpeciation = FALSE, full.phy = NULL, lowerBound = NULL,
  upperBound = NULL, opt.accept.rate = TRUE, acceptance.sd = NULL,
  opt.prop = 0.25, fine.tune.bound = 0.05, fine.tune.n = 30,
  useMean = FALSE, random.start = TRUE)

Arguments

y

A matrix of trait values.

phy

An object of class "phylo" (see ape package).

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

opt.accept.rate

Logical. Perform a pre-run optimisation to achieve an acceptance rate close to 0.44?

acceptance.sd

Numeric. The starting standard deviation for the proposal distribution

opt.prop

The proportion of the mcmc.iteration with which to optimise the acceptance rate.

fine.tune.bound

The distance (+/-) from the optimal acceptance rate of 0.44 at which the fine-tune algorithm will stop. Default = 0.05.

fine.tune.n

The number of iterations with which to optimise the acceptance rate.

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

Details

fine.tune.n The method estimates posterior probabilities using a Metropolis-Hastings MCMC approach. To aide convergence, the model will attempt to reach an acceptable proposal ratio (~0.44) when opt.accept.rate=TRUE. These initial fine-tune repititions only save the standard deviation for the truncated normal distribution that is used for the proposal mechanism. The chain is discarded. Posterior probabilites and MCMC diagnostics come from the seperate output chain that commences after this fine-tune procedure. 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

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)

motmot.2.0 documentation built on May 1, 2019, 9:22 p.m.