| TreEvo-package | R Documentation | 
A package for applying Approximate Bayesian Computation to estimating parameters of trait evolution in comparative analyses.
| Package: | TreEvo | 
| Type: | Package | 
| Version: | 0.3.3 | 
| Date: | 2012-07-02 | 
| License: | GPL | 
Brian O'Meara, Barb L. Banbury, David W. Bapst
Maintainer: David Bapst <dwbapst@gmail.com>
# example analysis, using data simulated with TreEvo
set.seed(1)
# let's simulate some data, and then try to infer the parameters using ABC
# get a 20-taxon coalescent tree
tree <- rcoal(20)
# get realistic edge lengths
tree$edge.length <- tree$edge.length*20
genRateExample <- c(0.01)
ancStateExample <- c(10)
#Simple Brownian motion
simCharExample <- doSimulation(
    phy = tree, 
    intrinsicFn = brownianIntrinsic, 
    extrinsicFn = nullExtrinsic, 
    startingValues = ancStateExample, #root state
    intrinsicValues = genRateExample, 
    extrinsicValues = c(0), 
    generation.time = 100000
    )
# NOTE: the example analyses below sample too few particles, 
    # over too few steps, with too few starting simulations
    # - all for the sake of examples that reasonably test the functions
# Please set these values to more realistic levels for your analyses!
resultsBMExample <- doRun_prc(
  phy = tree, 
  traits = simCharExample, 
  intrinsicFn = brownianIntrinsic, 
  extrinsicFn = nullExtrinsic, 
  startingPriorsFns = "normal", 
  startingPriorsValues = list(c(mean(simCharExample[, 1]), sd(simCharExample[, 1]))), 
  intrinsicPriorsFns = c("exponential"), 
  intrinsicPriorsValues = list(10), 
  extrinsicPriorsFns = c("fixed"), 
  extrinsicPriorsValues = list(0), 
  generation.time = 100000, 
  nRuns = 2, 
  nStepsPRC = 3, 
  numParticles = 20, 
     nInitialSimsPerParam = 10, 
  jobName = "examplerun_prc", 
  stopRule = FALSE, 
  multicore = FALSE, 
  coreLimit = 1
  )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.