| Title: | Comparing different ENM approaches |
|---|---|
| Description: | Facilitate running simulations to compare different approaches for ecological niche modelling, namely splitting, lumping, and fit models with partial pooling. See https://doi.org/10.1016/j.tree.2018.10.012 for more information. |
| Authors: | Francisco Rodriguez-Sanchez [aut, cre] |
| Maintainer: | Francisco Rodriguez-Sanchez <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.4 |
| Built: | 2026-05-19 07:06:50 UTC |
| Source: | https://github.com/Pakillo/lump.split.pool.ENM |
Calculate bias after simulations
calculate_bias(simdf)calculate_bias(simdf)
simdf |
Data frame with simulation results, as produced by |
A tidy data frame with simulation details and resulting bias for each method tested.
Fit Bayesian mixed model (brms)
fit_bayesmix(simdata, delta = 0.95)fit_bayesmix(simdata, delta = 0.95)
simdata |
List generated by |
delta |
adapt_delta parameter for brm |
A data frame with 4 columns (intercept estimate and standard error, and slope estimate and standard error), and as many rows as taxa.
Fit lump model
fit_lump(simdata)fit_lump(simdata)
simdata |
List generated by |
A data frame with 4 columns (intercept estimate and standard error, and slope estimate and standard error), and as many rows as taxa.
Fit mixed model (lme4)
fit_mixed(simdata)fit_mixed(simdata)
simdata |
List generated by |
A data frame with 4 columns (intercept estimate and standard error, and slope estimate and standard error), and as many rows as taxa.
Fit Bayesian phylogenetic mixed model (brms)
fit_pglmm(simdata, delta = 0.95)fit_pglmm(simdata, delta = 0.95)
simdata |
List generated by |
delta |
adapt_delta parameter for brm |
A data frame with 2 columns (intercept and slope estimate), and as many rows as taxa.
Fit split model
fit_split(simdata)fit_split(simdata)
simdata |
List generated by |
A data frame with 4 columns (intercept estimate and standard error, and slope estimate and standard error), and as many rows as taxa.
Plot niches
plot_niches(df = simdata$data2model, suitab.column = "suitab.invlogit")plot_niches(df = simdata$data2model, suitab.column = "suitab.invlogit")
df |
Data frame |
suitab.column |
Character. Name of the column containing suitability values |
A ggplot object
Run a number of simulations with fixed parameters
run_sims(nsim = 10, nspp = NULL, nsite = NULL, min.K = NULL, delta = NULL, run.pglmm = TRUE, force.run = FALSE, out.dir = getwd())run_sims(nsim = 10, nspp = NULL, nsite = NULL, min.K = NULL, delta = NULL, run.pglmm = TRUE, force.run = FALSE, out.dir = getwd())
nsim |
Number of replicate simulations to run |
nspp |
Number of taxa to simulate. |
nsite |
Number of sites (equal for all taxa) |
min.K |
Numeric Force minimum phylogenetic signal (Blomberg's K) for simulated intercepts and slopes? |
delta |
'adapt_delta' parameter for brm |
run.pglmm |
Logical. Run PGLMM? (default is TRUE). |
force.run |
Logical. If FALSE (the default) simulations will NOT be run if there is a simulation output file available with same parameters (nspp, nsite). If TRUE, simulations will run and the file will be overwritten. |
out.dir |
Path to folder where to simulations will be saved (in RDS format). |
A data.frame with nrow = nspp*nsim
Run simulation
run_simulation(nspp = NULL, nsite = NULL, min.K = NULL, delta = NULL, run.pglmm = TRUE)run_simulation(nspp = NULL, nsite = NULL, min.K = NULL, delta = NULL, run.pglmm = TRUE)
nspp |
Number of taxa to simulate. |
nsite |
Number of sites (equal for all taxa) |
min.K |
Numeric Force minimum phylogenetic signal (Blomberg's K) for simulated intercepts and slopes? |
delta |
'adapt_delta' parameter for brm |
run.pglmm |
Logical. Run PGLMM? (default is TRUE). |
A data.frame
Simulate dataset
simul_data(nspp = NULL, nsite = NULL, seed = NULL, min.K = NULL)simul_data(nspp = NULL, nsite = NULL, seed = NULL, min.K = NULL)
nspp |
Number of taxa |
nsite |
Number of sites |
seed |
Random seed |
min.K |
Numeric Force minimum phylogenetic signal (Blomberg's K) for simulated intercepts and slopes? |
A dataframe