sample.rates: Sample custom functions through time.

Description Usage Arguments Value Examples

View source: R/sample.rates.R

Description

Sample custom functions through time.

Usage

1
2
3
4
5
6
7
sample.rates(
  times,
  lambda0 = NULL,
  rsample = NULL,
  rsample0 = NULL,
  autocorrelated = FALSE
)

Arguments

times

the time knots

lambda0

The rate at present

rsample

Function to sample next rate

rsample0

Function to sample rate at present

autocorrelated

Should rates be autocorrelated?

Value

Sampled rate vector

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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, times)

rsample <- function(n) runif(n, min = 0.0, max = 0.9)
mu <- sample.rates(times, 0.5, rsample = rsample)


model_set <- congruent.models(model, mus = mu)

model_set

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