Package 'lump.split.pool.ENM'

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

Help Index


Calculate bias after simulations

Description

Calculate bias after simulations

Usage

calculate_bias(simdf)

Arguments

simdf

Data frame with simulation results, as produced by run_sims.

Value

A tidy data frame with simulation details and resulting bias for each method tested.


Fit Bayesian mixed model (brms)

Description

Fit Bayesian mixed model (brms)

Usage

fit_bayesmix(simdata, delta = 0.95)

Arguments

simdata

List generated by simul_data.

delta

adapt_delta parameter for brm

Value

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

Description

Fit lump model

Usage

fit_lump(simdata)

Arguments

simdata

List generated by simul_data.

Value

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)

Description

Fit mixed model (lme4)

Usage

fit_mixed(simdata)

Arguments

simdata

List generated by simul_data.

Value

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)

Description

Fit Bayesian phylogenetic mixed model (brms)

Usage

fit_pglmm(simdata, delta = 0.95)

Arguments

simdata

List generated by simul_data.

delta

adapt_delta parameter for brm

Value

A data frame with 2 columns (intercept and slope estimate), and as many rows as taxa.


Fit split model

Description

Fit split model

Usage

fit_split(simdata)

Arguments

simdata

List generated by simul_data.

Value

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

Description

Plot niches

Usage

plot_niches(df = simdata$data2model, suitab.column = "suitab.invlogit")

Arguments

df

Data frame

suitab.column

Character. Name of the column containing suitability values

Value

A ggplot object


Run a number of simulations with fixed parameters

Description

Run a number of simulations with fixed parameters

Usage

run_sims(nsim = 10, nspp = NULL, nsite = NULL, min.K = NULL,
  delta = NULL, run.pglmm = TRUE, force.run = FALSE,
  out.dir = getwd())

Arguments

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).

Value

A data.frame with nrow = nspp*nsim


Run simulation

Description

Run simulation

Usage

run_simulation(nspp = NULL, nsite = NULL, min.K = NULL,
  delta = NULL, run.pglmm = TRUE)

Arguments

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).

Value

A data.frame


Simulate dataset

Description

Simulate dataset

Usage

simul_data(nspp = NULL, nsite = NULL, seed = NULL, min.K = NULL)

Arguments

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?

Value

A dataframe