4 Inference performance

One of the primary purposes of the DAISIEmainland package and specifically why the data is formatted in the DAISIE format is to test the maximum likelihood inference models implemented in the DAISIE R package (Etienne et al. 2022). Therefore, in this section we explore how to conduct a simple performance analysis of one of the DAISIE models. In this case we are going to use the model with a single macroevolutionary regime on the island ( i.e. all island species are assumed to have the same rate of colonisation, speciation and extinction, as well as the same carrying capacity). This model also assumes that the carrying capacity only operates between species within the same island clade (termed clade-specific diversity-dependence), thus different island colonists are supposed independent and not inhibiting the diversification of each other.

As a small technical aside, this section uses DAISIE version 4.1.1. Re-running this code on another system may produce different results, especially if a different version of DAISIE is installed.

4.1 Simulating data

First, we simulate 100 replicates of island data. This will produce phylogenetic data for 100 islands with the same parameter values. The reason multiple island data sets are simulated is because the simualation algorithm is stochastic (Section 2) and by iterating the simulation many times it accounts for differences between data sets due to stochasticity. In an analysis more replicates (e.g. 1,000) can be run to account for the stochastic differences between replicates to more thoroughly sample the distribution of possible simulation outcomes.

Note: all the code below takes a substantial amount of time to run (on the order of hours for 100 replicates).

set.seed(
  1,
  kind = "Mersenne-Twister",
  normal.kind = "Inversion",
  sample.kind = "Rejection"
)

replicates <- 100

daisie_mainland_data <- DAISIEmainland::sim_island_with_mainland(
  total_time = 1,
  m = 100,
  island_pars = c(0.5, 02.5, 50, 0.01, 0.5),
  mainland_ex = 1.0,
  mainland_sample_prob = 1,
  mainland_sample_type = "complete",
  replicates = replicates,
  verbose = FALSE
)

Now we have the simulated data, stored in daisie_mainland_data (see section A.2.1), which is a list object. At the highest level of the list there are two lists: daisie_mainland_data$ideal_multi_daisie_data and daisie_mainland_data$empirical_multi_daisie_data. Each of these multi_daisie_data lists contains 100 elements, one for each simulation replicate. The daisie_mainland_data$ideal_multi_daisie_data and daisie_mainland_data$empirical_multi_daisie_data have the same structure. The first element of each is the meta data, containing: island_age and the number of species not_present on the island that are on the mainland.

daisie_mainland_data$ideal_multi_daisie_data[[1]][[1]]
#> $island_age
#> [1] 5
#> 
#> $not_present
#> [1] 959
daisie_mainland_data$empirical_multi_daisie_data[[1]][[1]]
#> $island_age
#> [1] 5
#> 
#> $not_present
#> [1] 959

Subsequent elements of the list are the island clades which are composed of: branching_times, status of colonisation or stac, and number of missing_species. The branching_times contains the age of the island, the time of colonisation and any subsequent cladogenetic speciation times. The stac is a numeric identifier of the endemicicity status and cladogenetic status (i.e. is the island colonist a singleton lineage or a clade). Lastly, the missing_species is the number of species known from an island clade but not included in the branching_times vector as there is no phylogenetic information on the timing of speciation for that species. In the DAISIEmainland simulation we assume that we have phylogenetic information on all species on the island and thus missing_species is always set to zero.

daisie_mainland_data$ideal_multi_daisie_data[[1]][[2]]
#> $branching_times
#> [1] 5.0000000 4.1284128 0.1607578
#> 
#> $stac
#> [1] 2
#> 
#> $missing_species
#> [1] 0
daisie_mainland_data$empirical_multi_daisie_data[[1]][[2]]
#> $branching_times
#> [1] 5.0000000 4.1284128 0.1607578
#> 
#> $stac
#> [1] 2
#> 
#> $missing_species
#> [1] 0

4.2 Maximum likelihood inference

To run a maximum likelihood DAISIE model, using the DAISIE_ML_CS() function, on each replicate we create objects to store the data in (ideal_ml and empirical_ml) and then loop over each replicate.

ideal_ml <- vector("list", replicates)
empirical_ml <- vector("list", replicates)

for (i in seq_len(replicates)) {
  ideal_ml[[i]] <- DAISIE::DAISIE_ML_CS(
    datalist = daisie_mainland_data$ideal_multi_daisie_data[[i]],
    initparsopt = c(0.5, 02.5, 50, 0.01, 0.5),
    idparsopt = 1:5,
    parsfix = NULL,
    idparsfix = NULL,
    ddmodel = 11,
    methode = "odeint::runge_kutta_fehlberg78",
    optimmethod = "simplex",
    jitter = 1e-5)
  
  empirical_ml[[i]] <- DAISIE::DAISIE_ML_CS(
    datalist = daisie_mainland_data$empirical_multi_daisie_data[[i]],
    initparsopt = c(0.5, 02.5, 50, 0.01, 0.5),
    idparsopt = 1:5,
    parsfix = NULL,
    idparsfix = NULL,
    ddmodel = 11,
    methode = "odeint::runge_kutta_fehlberg78",
    optimmethod = "simplex",
    jitter = 1e-5)
}

The details of the maximum likelihood set up are not important, but a brief explainer: all model parameters are optimisied with the starting position in parameter space for optimisation, equal to the values used to simulate the data; the Runge-Kutta Fehlberg method is used to numerically solve the likelihood equations; and simplex is the optimisation algorithm to maximise the likelihood.

4.3 Inference performance error metrics

Now we have simulated 100 data sets, each with an ideal and empirical data set, and fitted the DAISIE model to each, we need to quantify the error the DAISIE inference makes because it does not include mainland evolutionary dynamics.

The error metrics chosen to quantify this are:

  1. The difference between the parameter estimates from ideal and empirical data, for cladogenesis, extinction, carrying capacity, colonisation, and anagenesis. This can be calculated as the ideal estimate minus empirical estimate, or ideal estimate divided by the empirical estimate.
error_metrics$param_diffs
#> $clado_diffs
#>   [1]  0.0485671213  0.1373335180  0.1235759403  0.0953859594  0.1358954310  0.0866802387  0.1325293598  0.0040849011
#>   [9]  0.1258097861  0.1183624223  0.0209520854  0.0067349700  0.1405136758  0.0159262995  0.0332742438  0.0652122543
#>  [17]  0.0757534327  0.0703789053  0.0638534672  0.1123253518  0.0387860642  0.1389811329  0.0489951561  0.0057499664
#>  [25]  0.0982333242  0.0222870658  0.0925295642  0.0670060346  0.0241730403  0.0736598720  0.0939902206  0.0832876704
#>  [33]  0.0952014091  0.1183953843  0.0333036319  0.0788275212  0.0652345805  0.1196498887  0.0075744193  0.0007002778
#>  [41]  0.0565057260  0.1559784446  0.1600979463  0.0598963000  0.0778151524  0.0027668697  0.0596032902  0.1066499937
#>  [49] -0.0052408873  0.0855404107  0.1873826787  0.1366268656  0.0247300013  0.1278115324  0.1110532752  0.1702827555
#>  [57]  0.0580207482 -0.0269455300  0.1388745854  0.1932200372 -0.0484186886  0.1117052217  0.1250062565  0.0992634319
#>  [65]  0.0287133793  0.0731280890  0.1348903390  0.0948763814  0.0660694034  0.1196880994  0.2336268190  0.1672059897
#>  [73]  0.1535245336  0.0468435173  0.1429627692  0.2474280851  0.0520964225  0.0617982639  0.1516189004  0.0141226232
#>  [81]  0.0010783260  0.0519716199  0.0967431949  0.0659618055  0.0903201873  0.0977781642  0.0218629018 -0.0450911852
#>  [89]  0.0818354966  0.1339237117  0.2632617046  0.0381733346  0.0814707184  0.0771590033  0.0110410705  0.1906785193
#>  [97]  0.0557903264  0.0962286193 -0.0255369899 -0.0308531267
#> 
#> $ext_diffs
#>   [1]  6.857364e-02  1.097038e-01  1.125931e-01  4.725620e-02  5.632513e-02  1.481105e-01  2.000310e-01  6.071199e-02
#>   [9]  1.096539e-01  1.181260e-01  2.499557e-02  5.500459e-05  7.427308e-02  1.437063e-02  8.446332e-02  9.517239e-02
#>  [17]  1.764619e-01  1.127467e-01  6.058841e-02  8.199032e-02  4.615333e-02  1.056925e-01  1.125869e-01 -1.008727e-02
#>  [25]  9.737776e-02 -2.615180e-04  1.743287e-01  5.330404e-02  4.899761e-02  9.500368e-02  8.581763e-02  1.516548e-01
#>  [33]  1.404316e-01  1.459737e-01  7.720799e-02  1.257149e-01  9.721214e-02  7.475331e-02  1.620405e-02  2.231194e-04
#>  [41]  7.279873e-02  2.125234e-01  8.736661e-02 -5.667143e-06  4.749765e-02 -1.409081e-06  5.133049e-02  3.874742e-02
#>  [49] -1.146016e-02  1.087732e-01  1.769580e-01  8.652160e-02  4.636389e-02  1.202245e-01  1.293976e-01  1.215278e-01
#>  [57]  1.481257e-01  7.206466e-02  1.060878e-01  2.002648e-01 -6.393059e-03  1.226918e-01  1.788540e-01  1.217913e-01
#>  [65]  7.357735e-02  2.976577e-02  9.688404e-02  1.605063e-01  7.182201e-02  1.564635e-01  4.096875e-01  1.796573e-01
#>  [73]  1.716357e-01  2.250669e-02  1.071613e-01  2.330795e-01  9.216332e-02  1.279147e-01  2.238795e-01  6.356713e-02
#>  [81] -1.060943e-03  8.552440e-02  8.791171e-02  9.672859e-02  6.732924e-02  1.122435e-01  3.596650e-02 -3.778419e-02
#>  [89]  9.899419e-02  1.151449e-01  2.101046e-01  7.911586e-02  8.636993e-02  8.483219e-02  1.101010e-02  1.686426e-01
#>  [97]  4.570608e-02  8.918716e-02 -2.143301e-14  1.022372e-02
#> 
#> $k_diffs
#>   [1] -3.496213e-01 -1.760964e+00 -1.980145e-01 -4.525308e+00 -9.302610e+00  2.516986e-01          -Inf  1.100309e+00
#>   [9] -1.233321e-01 -1.451193e+00 -1.599502e+00 -4.807013e-02 -9.729760e-01 -1.184472e-02  6.068851e-01  2.209808e-01
#>  [17]           NaN  6.177416e-01 -1.283903e+00 -4.505470e-01  4.851449e-01  2.297718e-12           NaN -3.803513e-01
#>  [25] -1.129781e+00 -8.420514e-01           NaN -1.381843e-01  2.834243e-01 -1.263562e+01 -1.635090e+00           NaN
#>  [33]  2.079064e+00  5.580890e-01           NaN -1.341703e+00 -4.896262e+00 -1.127207e+00  7.736603e-01 -1.732510e-01
#>  [41] -3.770729e+00 -8.429657e+01 -2.515503e-01 -4.328450e+00 -2.366657e+00           NaN -6.352045e+00 -3.229599e-01
#>  [49]           NaN  8.838242e-01 -7.992154e+01 -1.273254e+00           NaN -4.879011e+00 -7.461650e+00 -1.068268e+01
#>  [57]           NaN  1.432933e+00 -1.462462e+00 -2.422899e+01  1.705262e+01          -Inf -4.951696e-01 -1.550811e+01
#>  [65]  8.432118e-01 -1.233582e-08 -8.160294e-01  6.544387e-01 -1.057907e+00 -1.546564e+00 -5.643018e+00  3.700340e-02
#>  [73] -7.188337e+00 -2.843850e+00 -2.659184e-01 -1.508660e+00  1.412603e+00           NaN          -Inf  4.060781e-01
#>  [81] -1.932961e-01  7.244419e-02 -1.481494e-01           NaN  7.736034e-11 -2.658060e+00  4.513234e-02  2.207231e+00
#>  [89]          -Inf -9.670351e+01 -6.814340e+00 -2.393552e+00 -7.651993e-01 -7.558605e-01  2.966476e-02 -9.004889e+00
#>  [97] -2.705575e+00 -7.597101e+00  5.761140e+01  1.930309e+00
#> 
#> $immig_diffs
#>   [1]  1.042022e-03  9.743975e-04  1.516408e-03  3.551594e-04  8.390961e-04  2.057175e-03  2.227582e-03  1.452176e-03
#>   [9]  1.008419e-03  1.327859e-03  3.412082e-04 -1.278710e-05  8.116564e-04  4.464987e-04  7.378906e-04  1.358666e-03
#>  [17]  3.348057e-03  1.454142e-03  1.077728e-03  6.188365e-04  7.090332e-04  9.048389e-04  1.994647e-03 -7.993683e-05
#>  [25]  1.063019e-03  1.821143e-05  1.938671e-03  4.111066e-04  5.295924e-04  9.949653e-04  6.655333e-04  2.129320e-03
#>  [33]  2.071309e-03  1.653417e-03  1.351098e-03  1.418462e-03  1.804811e-03  5.124829e-04  2.020163e-04  2.116319e-04
#>  [41]  1.416318e-03  2.782163e-03  7.752967e-04  2.087575e-04  2.787000e-04  1.919504e-04  6.559712e-04  1.238442e-04
#>  [49]  3.287926e-04  2.182717e-03  1.405726e-03  9.459177e-04  1.059625e-03  1.269979e-03  2.098623e-03  1.232630e-03
#>  [57]  1.161765e-03  1.645384e-03  1.440077e-03  1.610687e-03  3.843102e-04  1.502280e-03  2.127733e-03  1.308060e-03
#>  [65]  8.659956e-04  1.140500e-04  6.868319e-04  3.183439e-03  9.367026e-04  3.353336e-03  4.175519e-03  1.126795e-03
#>  [73]  2.030753e-03  2.275020e-04  1.187243e-03  2.105562e-03  1.559709e-03  1.728874e-03  3.312228e-03  5.882417e-04
#>  [81]  2.399429e-04  1.018908e-03  1.061724e-03  1.101474e-03  7.102028e-04  1.449428e-03  3.926257e-04 -4.089808e-04
#>  [89]  1.280796e-03  1.236879e-03  2.200531e-03  8.608049e-04  6.789350e-04  9.925445e-04  1.585696e-04  2.272000e-03
#>  [97]  4.468965e-04  7.226488e-04  1.442125e-04  5.610867e-04
#> 
#> $ana_diffs
#>   [1]  -2.81502418  -0.30755024  -8.83992684  -0.09823236  -6.37998771  -2.00149632  -0.52255434  -0.18900595
#>   [9]  -1.44201732  -1.36502610  -1.11886027  -0.40458206  -0.35338120  -1.71542320  -1.70200338  -2.03288606
#>  [17]  -4.98153156  -0.92630285  -1.49863569  -3.16133662  -0.22306379   1.16501822  -0.45087136 -99.23345781
#>  [25]  -0.42568490  -1.47454122  -1.82309850  -0.77802340  -2.74982881 -99.19490151  -0.43635432  -1.35225428
#>  [33]  -0.21317802  -1.95643284  -0.60724162  -3.01877683  -0.47780628  -1.26597480  -5.01345786  -0.86483660
#>  [41]  -1.86608664  -3.62904156  -0.75516449 -96.88273322  -2.68596835  -0.17875030  -1.17023276  -0.55650869
#>  [49]  -2.61311465  -1.19975469   0.51695521  -0.89282807  -7.03008622  -0.69367270  -0.89192587  -3.80878377
#>  [57]  -2.15111646  -1.22599348  -2.70004090  -0.71966370 -98.06618339  -0.70533170  -3.46826307  -1.27895765
#>  [65]  -0.76310280  -3.41426901  -0.12162699  -1.54694995  -1.27817247  -0.53709200  -2.17232671  -1.29543112
#>  [73] -98.25615324   0.00000000  -1.19148035  -7.23074816  -0.91334813  -3.80968955  -0.79059622  -2.96121375
#>  [81]  -1.56570253  -0.83990984  -0.21666682  -0.79426705  -0.35740054  -1.04115133  -0.42769514  -8.44618955
#>  [89]  -2.13413452  -1.56313291  -3.61881486  -1.55017243  -0.15521925  -0.73067508  -0.86176702  -2.91392867
#>  [97]  -2.24233168  -3.03266562 -98.50940645  -0.69419471
error_metrics$param_ratios
#> $clado_ratio
#>   [1] 1.1019247 1.2645962 1.2315766 1.2231733 1.2038794 1.0732537 1.3283457 1.0063321 1.1697543 1.1794265 1.0285701
#>  [12] 1.0138593 1.2180917 1.0233796 1.0619812 1.0821268 1.1856363 1.1443566 1.1089589 1.2182676 1.0394481 1.2455419
#>  [23] 1.1203024 1.0098534 1.1873124 1.0489651 1.2447870 1.0815000 1.0697073 1.1462584 1.1552739 1.1476469 1.1287327
#>  [34] 1.2280786 1.1002011 1.1743800 1.1101595 1.1488195 1.0114636 1.0012274 1.1347616 1.3979466 1.2114707 1.1029518
#>  [45] 1.1204869 1.0084438 1.1184261 1.1015717 0.9840621 1.1006664 1.3545575 1.1875476 1.0504432 1.2547194 1.1935862
#>  [56] 1.4246978 1.1300556 0.9609090 1.2241886 1.4629485 0.9149940 1.2652098 1.2217370 1.2170709 1.0486845 1.0753999
#>  [67] 1.2160452 1.1810725 1.0999879 1.2034898 1.5353281 1.2518833 1.2277219 1.1006048 1.1769789 1.4717583 1.0787394
#>  [78] 1.1547868 1.3423970 1.0253501 1.0020710 1.0908377 1.1745615 1.1009075 1.0931471 1.2598514 1.0391368 0.9447405
#>  [89] 1.1730173 1.2679206 1.4787505 1.1022435 1.0988597 1.1309307 1.0173436 1.6469116 1.1401073 1.2004272 0.9430654
#> [100] 0.9487790
#> 
#> $ext_ratio
#>   [1] 4.368896e+10 2.247107e+00 2.307965e+00 1.559733e+00 1.107176e+00 1.276581e+00 1.014503e+01 1.190183e+00
#>   [9] 1.236633e+00 1.708440e+00 1.049173e+00 9.870138e+09 1.286894e+00 1.056265e+00 2.337184e+00 1.288329e+00
#>  [17] 2.402821e+00 2.431660e+11 1.556109e+00 2.922531e+00 1.093333e+00 1.703661e+00 2.258062e+00 9.372024e-01
#>  [25] 2.317361e+00 1.108920e-09 5.176414e+00 1.208487e+00 1.775872e+11 1.333426e+00 1.929799e+00 1.384392e+00
#>  [33] 1.273000e+00 8.429728e+11 3.511354e+01 6.917127e+12 1.362813e+00 1.197913e+00 1.040595e+00 2.780516e+09
#>  [41] 2.278822e+00 4.860388e+00 1.314793e+00 1.507218e-07 1.123221e+00 1.732810e-04 5.036783e+00 1.086917e+00
#>  [49] 3.591096e-09 1.240306e+00 2.170009e+00 1.414762e+00 1.172721e+00 1.534977e+00 1.506628e+00 1.702878e+12
#>  [57] 2.200715e+06 1.273985e+00 1.397770e+00 3.674563e+11 9.818634e-01 2.482082e+00 2.475970e+00 1.476402e+00
#>  [65] 1.853170e+00 1.051781e+00 1.447594e+00 2.914421e+00 1.210774e+00 1.676642e+00 1.115805e+12 2.550256e+00
#>  [73] 2.148906e+00 2.686589e+11 1.223887e+00 8.296050e+00 1.230673e+00 1.546809e+00 2.641143e+00 6.002974e+00
#>  [81] 9.922770e-01 1.407970e+00 1.469073e+00 1.183168e+00 1.098108e+00 5.625863e+11 1.495995e+00 9.310646e-01
#>  [89] 1.401439e+00 1.627062e+00 1.861633e+00 3.318195e+00 1.155149e+00 1.599951e+00 1.029143e+00 5.342523e+02
#>  [97] 1.289240e+00 9.089077e+10 8.081950e-01 1.031266e+00
#> 
#> $k_ratio
#>   [1] 0.9759979 0.8851219 0.9728497 0.7712869 0.5355142 1.0226588 0.0000000 1.0990068 0.9865571 0.9109885 0.9512656
#>  [12] 0.9935885 0.9054963 0.9988169 1.0279555 1.0129938       NaN 1.0350560 0.9485566 0.9528544 1.0554575 1.0000000
#>  [23]       NaN 0.9764286 0.9188533 0.9353091       NaN 0.9892863 1.0062481 0.7622975 0.9332112       NaN 1.0863003
#>  [34] 1.0569779       NaN 0.9592238 0.7443303 0.9275784 1.0044091 0.9850291 0.8670505 0.2003501 0.9624100 0.7570835
#>  [45] 0.8976065       NaN 0.7193965 0.9673533       NaN 1.0477054 0.2590141 0.9277677       NaN 0.7516033 0.8196856
#>  [56] 0.4771808       NaN 1.1933501 0.8689615 0.4057954 1.6938724 0.0000000 0.9740698 0.7017777 1.0594442 1.0000000
#>  [67] 0.9296927 1.0381618 0.9322491 0.8580620 0.8047749 1.0057703 0.8028354 0.8646753 0.9716147 0.8642064 1.1147170
#>  [78]       NaN 0.0000000 1.0423507 0.9884308 1.0049769 0.9792744       NaN 1.0000000 0.8869874 1.0031085 1.1403730
#>  [89] 0.0000000 0.2914180 0.6367512 0.9233759 0.9688190 0.9604435 1.0037081 0.4508025 0.8505793 0.8283872 2.7275012
#> [100] 1.1199524
#> 
#> $immig_ratio
#>   [1] 1.1208684 1.1310031 1.1766406 1.0559947 1.0772917 1.2234355 1.3374036 1.1459946 1.1009760 1.1295151 1.0260638
#>  [12] 0.9980173 1.0632580 1.0440015 1.1134424 1.1277152 1.3252620 1.1856656 1.1237274 1.1039668 1.0770954 1.1308119
#>  [23] 1.2249763 0.9904184 1.1232711 1.0020259 1.2684106 1.0485719 1.0801134 1.1164359 1.0957965 1.1775955 1.1756976
#>  [34] 1.2752436 1.1865987 1.2149293 1.1875892 1.0541904 1.0216487 1.0263911 1.1585339 1.4006457 1.0764068 1.0316560
#>  [45] 1.0359661 1.0329992 1.1005446 1.0141781 1.0407157 1.1957650 1.2522359 1.1036875 1.0876331 1.1412202 1.1719301
#>  [56] 1.1762298 1.2147905 1.1678468 1.1418940 1.2869597 1.0431875 1.1668380 1.2605257 1.1514541 1.1293670 1.0095504
#>  [67] 1.0965260 1.3232910 1.0768819 1.2804492 1.7252252 1.2209662 1.2143799 1.0299591 1.0903716 1.4030301 1.1376007
#>  [78] 1.2261965 1.3912836 1.0873358 1.0255434 1.1489269 1.1073064 1.0960557 1.0466218 1.1948394 1.0457636 0.9706315
#>  [89] 1.1571197 1.1306892 1.2649934 1.1235443 1.0727404 1.0992527 1.0136102 1.3161109 1.0606378 1.1164211 1.0240545
#> [100] 1.0525936
#> 
#> $ana_ratio
#>   [1] 3.829679e-01 6.522835e-01 1.790843e-01 9.374789e-01 1.190392e-01 1.762753e-12 6.893415e-01 9.064945e-01
#>   [9] 5.902257e-01 4.327097e-01 4.262540e-01 8.078228e-01 8.935561e-01 2.963010e-01 3.135234e-01 5.913718e-01
#>  [17] 2.275231e-01 5.626318e-01 4.892840e-01 3.868135e-01 8.233284e-01 1.092117e+00 7.145972e-01 7.665422e-03
#>  [25] 6.638959e-01 4.290807e-01 3.756175e-01 3.982345e-01 2.519282e-01 8.050985e-03 4.186570e-01 6.632527e-01
#>  [33] 8.996221e-01 6.134037e-01 6.326801e-01 2.487922e-01 7.171181e-01 7.698045e-01 1.092587e-01 6.496507e-01
#>  [41] 2.398907e-01 2.561441e-01 7.063178e-01 3.117267e-02 2.706573e-01 8.655616e-01 4.837991e-01 8.691849e-01
#>  [49] 3.598866e-01 5.850882e-01 1.212092e+00 5.966360e-01 1.227338e-01 5.924129e-01 3.800267e-01 3.010002e-01
#>  [57] 2.570959e-01 4.042118e-01 2.361965e-01 5.289609e-01 1.933817e-02 5.594226e-01 3.991974e-01 2.454061e-01
#>  [65] 7.476550e-01 2.341141e-01 9.144005e-01 6.326505e-01 6.258742e-01 6.829908e-01 5.093517e-01 6.669009e-01
#>  [73] 1.743847e-02 1.000000e+00 2.761089e-01 2.276879e-01 5.536222e-01 2.310265e-01 5.404810e-01 2.352762e-01
#>  [81] 3.998440e-01 7.150560e-01 8.971522e-01 6.044293e-01 7.463653e-01 5.568244e-01 8.181816e-01 9.041582e-02
#>  [89] 5.485972e-01 3.040310e-01 1.567141e-01 4.059717e-01 7.918612e-01 5.667673e-01 3.742646e-01 5.592775e-01
#>  [97] 2.653516e-01 2.743024e-01 1.490594e-02 8.185683e-01
  1. Delta CTT (\(\Delta\)CTT) (difference in colonisations through time) between the ideal and empirical data. Calculated as:

\[ \Delta nCTT = \int_{0}^{1} | nCTT_{ideal}(t) - nCTT_{empirical}(t) | dt \]

error_metrics$delta_ctt
#>   [1] 0.17155232 0.11695078 0.14791992 0.07678659 0.14403409 0.14486446 0.12221146 0.11226794 0.04766100 0.12277885
#>  [11] 0.07824080 0.12537940 0.17947178 0.09771132 0.10608182 0.09426436 0.11128204 0.08052833 0.14026127 0.15026305
#>  [21] 0.08950161 0.16149038 0.06570476 0.10174456 0.11555421 0.12137929 0.12067028 0.09847416 0.11214094 0.12464379
#>  [31] 0.10306867 0.13009035 0.12464288 0.15585429 0.17651730 0.14776988 0.12273101 0.09836984 0.14499881 0.15081492
#>  [41] 0.13135130 0.16710886 0.13547439 0.15243449 0.13594079 0.12404993 0.07058998 0.08583650 0.09308716 0.14313386
#>  [51] 0.05876224 0.16236322 0.11175274 0.09712582 0.12472783 0.13606670 0.15919436 0.11084444 0.10562117 0.08244299
#>  [61] 0.12169974 0.14242685 0.18316439 0.06892195 0.11628010 0.11634245 0.16297475 0.16968625 0.05038661 0.08744617
#>  [71] 0.20206509 0.07073775 0.12597444 0.07686876 0.07693023 0.13157247 0.15216802 0.14162742 0.12711394 0.07499071
#>  [81] 0.09835805 0.11799740 0.10644828 0.13006720 0.08739035 0.13488771 0.08041684 0.11975591 0.16024984 0.16527204
#>  [91] 0.20883705 0.11701884 0.08961436 0.10196080 0.12944348 0.17224067 0.16286731 0.10224647 0.11633248 0.09333321
  1. Percentage of maximum island age colonisations (i.e. colonisations where the most recent colonisation time extracted from the phylogenetic data is older than the island) for the ideal and empirical data (only including colonisations that survive to the present). The ideal max age percentage is always zero as it is always known exactly when the species colonised the island, but is still calculated to check it is zero. The empirical max age percent can be any percent [0, 100].
error_metrics$max_age_percent
#> $ideal_max_age
#>   [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#>  [58] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
#> 
#> $empirical_max_age
#>   [1] 34.883721 24.242424 28.947368 10.714286 21.428571 32.142857 28.125000 24.242424 14.285714 30.952381 19.444444
#>  [12] 34.375000 26.086957 24.324324 36.666667 21.621622 20.930233 28.205128 18.421053 25.000000 18.518519 28.571429
#>  [23] 23.076923 23.529412 38.461538 33.333333 23.529412 21.875000 30.303030 31.034483 29.032258 27.777778 18.750000
#>  [34] 23.333333 38.888889 33.333333 26.470588 22.580645 34.482759 35.000000 21.951220 34.375000 30.555556 36.363636
#>  [45] 20.833333 34.482759 25.000000 14.285714 20.000000 17.647059  8.695652 27.777778 21.428571 18.181818 25.000000
#>  [56] 37.142857 51.851852 28.571429 25.000000 28.571429 21.428571 27.500000 48.571429 13.333333 30.000000 18.750000
#>  [67] 29.629630 38.636364 17.500000 20.454545 37.931034 27.272727 27.500000 21.052632 18.918919 32.000000 23.529412
#>  [78] 22.222222 34.285714 39.393939 20.512821 30.769231 23.684211 20.000000 14.285714 24.324324 23.076923 21.621622
#>  [89] 20.689655 27.027027 23.333333 36.363636 28.000000 28.571429 28.571429 25.000000 31.034483 22.580645 26.666667
#> [100] 28.571429
  1. Percent of endemic species at the present. This includes counts of the number of endemic and non-endemic species in the ideal and empirical data, as well as the calculation of the percentage of endemic species in each data set.
error_metrics$endemic_percent
#> $ideal_endemic_percent
#>   [1]  96.66667  92.55319  95.50562  94.73684  95.23810  97.80220  93.54839  98.76543  93.10345  95.55556  88.42105
#>  [12]  94.87179  97.45763  92.47312  94.84536  96.52174  94.49541  97.65625  97.88732  95.89041  94.36620  98.18182
#>  [23]  94.49541  97.05882  95.12195  97.01493  93.54839  92.23301  92.68293  97.26027  96.80000  94.50549  96.38554
#>  [34]  98.82353  94.00000  97.19626  95.45455  98.93617  96.84211  97.10145  93.10345  96.62921  96.51163  99.15966
#>  [45]  93.33333  95.18072  95.14563  97.70115  96.22642  97.36842  97.22222  96.99248  96.46018  95.00000  93.89313
#>  [56]  96.73913  94.73684  93.82716  94.50549  92.40506  98.48485  96.66667  96.26168  91.30435  96.70330  96.25000
#>  [67]  95.77465  99.27536  98.01980  89.89899  96.15385  96.15385  98.84393 100.00000  87.95181  97.36842  94.87179
#>  [78]  91.52542  93.61702  97.95918  92.30769  95.58824  93.82716  95.00000  89.18919  92.55319  96.46018  94.79167
#>  [89]  96.05263  94.69027  93.58974  94.11765  88.05970  95.12195  91.42857  95.89041  93.65079  96.85039  99.04762
#> [100]  96.47059
#> 
#> $empirical_endemic_percent
#>   [1]  97.50000  92.55319  98.87640  94.73684  96.82540  97.80220  94.62366  98.76543  96.55172  97.03704  90.52632
#>  [12]  94.87179  97.45763  95.69892  96.90722  97.39130  98.16514  97.65625  98.59155  97.26027  94.36620  98.18182
#>  [23]  95.41284 100.00000  95.12195  97.76119  96.77419  93.20388  96.34146 100.00000  96.80000  95.60440  96.38554
#>  [34]  98.82353  95.00000  99.06542  95.45455  98.93617  98.94737  97.10145  96.55172  97.75281  96.51163 100.00000
#>  [45]  96.66667  95.18072  97.08738  97.70115  98.11321  98.24561  97.22222  97.74436 100.00000  96.25000  96.18321
#>  [56]  97.82609  95.78947  97.53086  96.70330  93.67089 100.00000  98.33333  97.19626  95.65217  96.70330  98.75000
#>  [67]  95.77465  99.27536  99.00990  90.90909  97.43590  96.15385 100.00000 100.00000  92.77108  98.68421  96.15385
#>  [78]  96.61017  95.74468  98.97959  94.23077  95.58824  93.82716  96.25000  90.54054  95.74468  96.46018  97.91667
#>  [89]  97.36842  97.34513  97.43590  95.29412  88.05970  95.93496  94.28571  97.26027  96.82540  97.63780 100.00000
#> [100]  96.47059
#> 
#> $ideal_endemics
#>   [1] 116  87  85  72  60  89  87  80  54 129  84  74 115  86  92 111 103 125 139  70  67  54 103  99 117 130  87  95
#>  [29]  76  71 121  86  80  84  94 104  84  93  92 134 108  86  83 118  56  79  98  85 102 111  70 129 109  76 123  89
#>  [57]  90  76  86  73  65 116 103  63  88  77  68 137  99  89  75  50 171 125  73  74  74  54  88  96  96  65  76  76
#>  [85]  66  87 109  91  73 107  73  80  59 117  64  70  59 123 104  82
#> 
#> $ideal_non_endemics
#>   [1]  4  7  4  4  3  2  6  1  4  6 11  4  3  7  5  4  6  3  3  3  4  1  6  3  6  4  6  8  6  2  4  5  3  1  6  3  4  1
#>  [39]  3  4  8  3  3  1  4  4  5  2  4  3  2  4  4  4  8  3  5  5  5  6  1  4  4  6  3  3  3  1  2 10  3  2  2  0 10  2
#>  [77]  4  5  6  2  8  3  5  4  8  7  4  5  3  6  5  5  8  6  6  3  4  4  1  3
#> 
#> $empirical_endemics
#>   [1] 117  87  88  72  61  89  88  80  56 131  86  74 115  89  94 112 107 125 140  71  67  54 104 102 117 131  90  96
#>  [29]  79  73 121  87  80  84  95 106  84  93  94 134 112  87  83 119  58  79 100  85 104 112  70 130 113  77 126  90
#>  [57]  91  79  88  74  66 118 104  66  88  79  68 137 100  90  76  50 173 125  77  75  75  57  90  97  98  65  76  77
#>  [85]  67  90 109  94  74 110  76  81  59 118  66  71  61 124 105  82
#> 
#> $empirical_non_endemics
#>   [1] 3 7 1 4 2 2 5 1 2 4 9 4 3 4 3 3 2 3 2 2 4 1 5 0 6 3 3 7 3 0 4 4 3 1 5 1 4 1 1 4 4 2 3 0 2 4 3 2 2 2 2 3 0 3 5 2 4
#>  [58] 2 3 5 0 2 3 3 3 1 3 1 1 9 2 2 0 0 6 1 3 2 4 1 6 3 5 3 7 4 4 2 2 3 2 4 8 5 4 2 2 3 0 3

Overall, all of these error metrics can be computed using calc_error() with the simulated data and the maximum likelihood estimates.

errors <- DAISIEmainland::calc_error(
  daisie_mainland_data = daisie_mainland_data,
  ideal_ml = ideal_ml,
  empirical_ml = empirical_ml
)

The code displayed in this chapter is a simplified version of the script used to carry out the full inference performance analysis can be found here.