Learn R Programming

CRABS (version 1.2.0)

sample.rates: Sample custom functions through time.

Description

Sample custom functions through time.

Usage

sample.rates(
  times,
  lambda0 = NULL,
  rsample = NULL,
  rsample0 = NULL,
  autocorrelated = FALSE
)

Value

Sampled rate vector

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?

Examples

Run this code
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

Run the code above in your browser using DataLab