knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
Load required package DAISIE
library(DAISIE)
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')
Clade_name
- Name of the clade/lineage on the island (e.g. clade code, genus name) Status
- Endemicity status of the clade. Can be the following Endemic
; Non_endemic
; Endemic_MaxAge
, Non_Endemic_MaxAge
The latter two options are for cases when the time of colonisation is believed to be an overestimate. In these cases, DAISIE will assume colonisation happened any time between the colonisation time given in Branching_times
and the present, or between the colonisation time given in Branching_times
and the age of the first cladogenesis event in the lineage (if any). The MaxAge options can also be used when the colonization time is unknown, specifying "NA" in the column Branching_times
, in which case DAISIE will assume that colonisation happened any time between the age of the island and the present.Missing_species
- Number of extant species that belong to the clade but are not included in the phylogeny.Branching_times
- First element is the colonisation time, subsequent elements are branching times within the island if there are any. e.g. c(colonisation_time, branching_time1; branching_time2). If colonisation time is unknown, 'NA' can be specified. If branching times are unknown, do not replace them with 'NA' - just add the corresponding number of missing species to the column Missing_species
. \
\
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)
\
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.
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.
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
\
# DAISIE_plot_age_diversity(frogs_datalist)
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
:
Inf
. 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:
datalist
- The name of the DAISIE datalist (in this case frogs_datalist
)initparsopt
- these are the initial values from the parameters for which the likelihood will be optimised. In the examples below we will use parameters similar to the maximum likelihood parameters from the corresponding models in Etienne et al 2020. However, we recommend you try a variety of initial starting parameters to ensure the optimum is found. Note that certain combinations of initial starting values may fail, as parameters must be feasible (e.g. a K' value lower than the number of species found in the data will not run). In DAISIE the parameters have the following position:idparsopt
- The position of the parameters to optimise (e.g. to optimize cladogenesis and anagenesis only c(1,5).parsfix
- If parameters are being fixed, specify here the value (e.g. if fixing K' to Inf and fixing anagenesis to 0 - c(Inf,0).idparsfix
- The position of the paratemers fixed (e.g. to fix K' and anagenesis c(3,5)).ddmodel
- Set 0 for diversity-independent models; 11 for diversity-dependent models (IW and CS) where cladogenesis and colonisation decline linearly with diversity. There are other options. ? DAISIE_ML
\
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.
\
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))
\
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. \
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.
\
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).
\
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). \
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:
pars
- The values of the 5 parameters in the following orderreplicates
- Number of replicates to simulatetime
- Time to run the simulation, for example 20 million yearsM
- Number species in the mainland pooldivdepmodel
- set CS
for clade-specific diversity-dependence; or IW
for island-wide diversity-dependenceSimulate 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)
\
DAISIE_plot_sims(frog_sims_CS)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.