sample.congruence.class: Stochastic exploration of congruent models.

Description Usage Arguments Value Examples

View source: R/sample.congruence.class.R

Description

Stochastic exploration of congruent models.

Usage

1
2
3
4
5
6
7
sample.congruence.class(
  model,
  num.samples,
  rate.type = "both",
  sample.speciation.rates = NULL,
  sample.extinction.rates = NULL
)

Arguments

model

the reference model, an object of class "ACDC"

num.samples

The pulled diversification rate function (measured in time before present).

rate.type

either "extinction", "speciation", or "both"

sample.speciation.rates

a function that when called returns a speciation rate function

sample.extinction.rates

a function that when called returns a extinction rate function

Value

A named list with congruent rates.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
data("primates_ebd")

l <- approxfun(primates_ebd[["time"]], primates_ebd[["lambda"]])
mu <- approxfun(primates_ebd[["time"]], primates_ebd[["mu"]])
times <- primates_ebd[["time"]]

model <- create.model(l, mu, primates_ebd[["time"]])

extinction_rate_samples <- function(){
   res <- sample.basic.models(times = times, 
                              rate0 = 0.05, 
                              model = "MRF", 
                              MRF.type = "HSMRF", 
                              fc.mean = 2.0, 
                              min.rate = 0.0, 
                              max.rate = 1.0)
   return(res)
} 

samples <- sample.congruence.class(model, 
                                   num.samples = 8,
                                   rate.type = "extinction",
                                   sample.extinction.rates = extinction_rate_samples)

ACDC documentation built on Jan. 13, 2022, 1:08 a.m.