Learn R Programming

treedater (version 1.0.2)

gibbs_jitter: Sample node dates conditional on root time using Gibbs sampling and date prior

Description

This function is useful for 'smoothing out' time trees that have many adjacent small branch lengths (essential polytomies). It returns a list of smoothed trees.

Usage

gibbs_jitter(
  dtr,
  iter = 1000,
  burn_pc = 20,
  returnTrees = 10,
  res = 100,
  report = 10
)

Value

A list of treedater trees

Arguments

dtr

A treedater fit

iter

Number of iterations (every node time is resampled in each iteration )

burn_pc

Remove this proportion as burn-in

returnTrees

Integer number of trees to return.

res

Time resolution for proposing new node times

report

Report progress after this many iterations. Set to Inf to turn it off

Examples

Run this code
if (FALSE) {
# make a random tree:
tre <- ape::rtree(50)
# sample times based on distance from root to tip:
sts <- setNames( ape::node.depth.edgelength( tre )[1:ape::Ntip(tre)], tre$tip.label)
# modify edge length to represent evolutionary distance with rate 1e-3:
tre$edge.length <- tre$edge.length * 1e-3
# treedater:
td <- dater( tre, sts =sts, clock='strict', s = 1000, omega0=.0015 )
gibbs_jitter( td )
}

Run the code above in your browser using DataLab