sample.rates {CRABS}R Documentation

Sample custom functions through time.

Description

Sample custom functions through time.

Usage

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

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

[Package CRABS version 1.2.0 Index]