Demo: Fitting clade-specific and island-wide diversity-dependence models in DAISIE"

knitr::opts_chunk$set(
 collapse = TRUE,
 comment = "#>"
)

Load required package DAISIE

library(DAISIE)

1. Load, prepare and visualize data

Load the phylogenetic data for Eleutherodacylus frogs from the island of Hispaniola (used in Etienne et al. 2020). This dataset contains times of colonization and branching times for all species of Eleutherodactylus frogs found on the island. The data was extracted from the dated molecular phylogeny of Dugo-Cota et al 2019 (Ecology Letters 22:884–893). The dataset includes 65 extant species, which are the result of five independent colonisation events of the island of Hispaniola.

data(frogs_datatable, package = "DAISIE")

You can load your own data in a table/tibble format, making sure the table headers match the ones in the example.

knitr::kable(frogs_datatable,caption= 'Eleutherodactylus data table')
The table contains the following 4 columns (column headers need to be written exactly like this):

\

\

1.1. Create DAISIE datalist from the input table

In this case we are assuming an island age of 30 million years for Hispaniola and a mainland pool size of 300 species (this is the number of species that may colonize the island).

frogs_datalist <- DAISIE_dataprep(
        datatable = frogs_datatable,
        island_age = 30,
        M = 300)

\

1.2. View DAISIE datalist

Just type:

frogs_datalist

The DAISIE datalist includes the data from the table frogs in the format of a DAISIE object that can be read in the subsequent maximum likelihood functions (e.g DAISIE_ML, DAISIE_ML_IW ). It includes the age of the island, the number of mainland species that are not currently present on the island and a list with all extant independent colonisation events, including their colonization and branching times.

1.3. Visualise the data

DAISIE_plot_island(frogs_datalist)

This plot shows the different colonization events, their times of colonization and branching times (horizontal ticks). Dashed line shows the age of the island. n=number of species; m= number of species missing.

\
\
\ \ \
\
\ \
\
\
\ \ \
\
\ \

Plot age versus diversity

# DAISIE_plot_age_diversity(frogs_datalist)

2. Fit DAISIE models

If you skipped step 1, first load the Hispaniola Eleutherodactylus datalist.

data(frogs_datalist)

_

We will fit five different DAISIE models to the phylogenetic data contained in frogs_datalist:

We use the DAISIE_ML and DAISIE_ML_IW functions to optimise the likelihood. These are the most important settings to specify in these functions:

\

The IW models (IW and IW_no_ana) use the island-wide version of DAISIE, which is computationally demanding. They require high memory and long run times. We recommend these are run on a cluster. The CS models can be run on a regular computer or laptop.

\

2.1 Fit DI model

This model contains 4 parameters:
1 - cladogenesis
2 - extinction
4 - colonisation
5 - anagenesis
K' is fixed to Inf
Set ddmodel=0

DAISIE_ML(
  datalist = frogs_datalist,
  initparsopt = c(0.18,0.03,0.0006,2),
  idparsopt = c(1,2,4,5),
  ddmodel = 0,
  parsfix = Inf,
  idparsfix = 3
)
readRDS(file = system.file("extdata", "frog_M1_ML.rds", package = "DAISIE", mustWork = TRUE))

\

2.2 Fit CS model

This model contains 5 parameters:
1 - cladogenesis
2 - extinction
3 - K'
4 - colonisation
5 - anagenesis
Set ddmodel=11

DAISIE_ML(
  datalist = frogs_datalist,
  initparsopt = c(0.44,0.11,36.44,0.0007,2),
  idparsopt = c(1,2,3,4,5),
  ddmodel = 11,
  parsfix = NULL,
  idparsfix = NULL
)

Output not shown here. \

2.3 Fit CS_no_ana model

This model contains 4 parameters:
1 - cladogenesis
2 - extinction
3 - K'
4 - colonisation
Set ddmodel=11

DAISIE_ML(
  datalist = frogs_datalist,
  initparsopt = c(0.44,0.11,36.44,0.0007),
  idparsopt = c(1,2,3,4),
  ddmodel = 11,
  parsfix = 0,
  idparsfix = 5
)

Output not shown here.

\

2.4 Fit IW model

This model contains 5 parameters:
1 - cladogenesis
2 - extinction
3 - K'
4 - colonisation
5 - anagenesis
Set ddmodel=11

DAISIE_ML_IW(
  datalist = frogs_datalist,
  initparsopt = c(0.41, 0.17, 131.7, 0.0012, 2),
  idparsopt = c(1,2,3,4,5),
  ddmodel = 11,
  parsfix = NULL,
  idparsfix = NULL
)

Output not shown here (recommended to be run on a cluster).

\

2.5 Fit IW_no_ana model

This model contains 4 parameters:
1 - cladogenesis
2 - extinction
3 - K'
4 - colonisation
Set ddmodel=11

DAISIE_ML_IW(
  datalist = frogs_datalist,
  initparsopt = c(0.40, 0.17, 131.83, 0.0012),
  idparsopt = c(1,2,3,4),
  ddmodel = 11,
  parsfix = 0,
  idparsfix = 5
)

Output not shown here (recommended to be run on a cluster). \

3. Simulate islands under given DAISIE models

3.1 Simulate islands with the parameters estimated from the best model for the Hispaniolan Eleutherodacytlus data

We use the DAISIE_sim function, which simulates diversity dynamics on an island from island birth until a specificied island age, based on a given set of parameters (cladogenesis, extinction, carrying-capacity (K'), colonisation, anagenesis). These are the most important settings to specify in DAISIE_sim function:

Simulate a CS model for 30 million years, 100 replicates:

set.seed(1)
frog_sims_CS <- DAISIE_sim_cr(
  time=30,
  M=300,
  pars=c(0.44,0.11,36.44,0.0007,0),
  divdepmodel = "CS",
  replicates= 100,
  plot_sims = FALSE)

Simulate an IW model for 30 million years, 100 replicates:

set.seed(1)
frog_sims_CS <- DAISIE_sim_cr(
  time=30,
  M=300,
  pars=c(0.40,0.17,131.83,0.0012,0),
  divdepmodel = "IW",
  replicates= 100,
  plot_sims = FALSE)

\

3.2 Plot the species-through-time plots resulting from the simulations.

DAISIE_plot_sims(frog_sims_CS)


Try the DAISIE package in your browser

Any scripts or data that you put into this service are public.

DAISIE documentation built on Oct. 22, 2023, 1:06 a.m.