make_BayesCMR_2clades: Function to construct two clade CMR-model.

Description Usage Arguments Details Value Examples

View source: R/make_BayesCMR_2clades.R

Description

This function generates a structure containing the necessary functions for a CMR analysis of two clades. In addition to drivers affecting both clades, their rates of speciation and extinction can depend on the estimated diversity of both clades.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
make_BayesCMR_2clades(
  Obs1,
  Obs2,
  dts = rep(1, dim(Obs1)[2]),
  spec1 = ~time,
  ext1 = ~time,
  samp1 = ~time,
  spec2 = ~time,
  ext2 = ~time,
  samp2 = ~time,
  pfix = 2,
  modeltype = "IV",
  data = NULL,
  ...
)

Arguments

Obs1

observations clade 1: a matrix with size number of taxa by number of intervals (n). Each taxa has a row with 0's (unobserved) and 1's (observed) for each interval in the analysis. Oldest interval is first column.

Obs2

observations clade 1: a matrix with size number of taxa by number of intervals (n). Each taxa has a row with 0's (unobserved) and 1's (observed) for each interval in the analysis. Oldest interval is first column.

dts

a vector of interval durations. Defaults to series of 1's if not given.

pfix

a switch to select which approach is used to solve the identifiability problem in the model. If pfix = 1, then the sampling rate in the first and the last intervals are assumed to be equal to the mean sampling rate for the whole period. If pfix = 2, then the first two intervals, and the last two intervals have the same sampling rate. Defaults to pfix = 2.

modeltype

Which parameterization of the likelihood functino to be used. See ?Compadre for details. Defaults to 'IV'

data

data frame of possible external drivers.

spec1/ext1/samp1

Formulas for clade 1. Estimated diversity of clade 1 is denoted div1 and for clade 2, div2. E.g. spec1 = ~div1+div2+time, will include two impacts on the speciatino rate of clade 1, estimated diversity of clade 1 (div1) and estimated diversity of clade 2 (div2). These can also interact with other drivers, e.g. spec1= ~div1*driver1 + time

Details

Both clades must be observed at each interval and these must be the same for the two clades.

Value

CMR_model

Examples

1
M1 <- make_BayesCMR_2clades(Obs1,Obs2,dts=rep(2,5))

josteist/Compadre documentation built on June 3, 2021, 1:02 p.m.