Skip to contents

Whether a niche shift is detected can depend more on methodological choices than on the organisms: in freshwater invaders, background selection, the variables and the environmental space changed overlap and test results more than biological factors did (Lo Parrino et al. 2023). overlap_scenarios() runs niche_overlap() over a grid of choices, as m_scenarios() does for the accessible area, and says whether the conclusion holds across them:

Usage

overlap_scenarios(
  records,
  env,
  group = "group",
  backgrounds = list(whole = NULL),
  spaces = c("pca", "raw"),
  thin_km = c(0, 10),
  grids = c(50, 100),
  alpha = 0.05,
  seed = NULL,
  coords = NULL,
  points_crs = "EPSG:4326",
  ...,
  crs = NULL
)

Arguments

records

Records: a data.frame (or CSV path, sf, SpatVector) with coordinates and a group column, or a named list of record tables, one per group.

env

Predictor rasters shared by all groups.

group

Column with the group of each record.

backgrounds

Named list of background specifications for niche_overlap(); use NULL as an element for the whole raster, e.g. list(M = list(A = m_A, B = m_B), whole = NULL).

spaces

"pca" and/or "raw".

thin_km

Thinning distances (km); 0 = no thinning.

grids

Grid sizes of the density estimate.

alpha

Significance level for the verdicts.

seed

Optional random seed.

coords

Optional names of the x/longitude and y/latitude columns when points are tabular. Detected automatically if NULL.

points_crs

CRS of tabular coordinates (default WGS84, "EPSG:4326").

...

Passed to niche_overlap() (e.g. n_rep, vars, marginal_env).

crs

Deprecated: the former name of points_crs, still accepted with a warning.

Value

A list of class overlap_scenarios: results (one row per scenario and pair: the choices, D, I, expansion, unfilling, p-values and verdicts), robustness (per pair and test: number of scenarios per verdict and the choice that changes it most) and settings.

Details

  • backgrounds: named alternatives for the available environment (e.g. the accessible areas of each group against the whole raster);

  • spaces: the PCA environmental space or two raw predictors;

  • thin_km: records unthinned (0) or thinned to one per cell of a grid of that size (km), which reduces the weight of intensively sampled places;

  • grids: the resolution of the density estimate.

For each pair of groups and each test, the printout reports in how many scenarios the verdict is the same and, when it changes, which choice changes it: the share of pairs of scenarios that differ only in that choice and give different verdicts.

Status and limits. A preENM sensitivity design after Lo Parrino et al. (2023). Each scenario repeats the tests, so with many scenarios some differ by chance: read the share of scenarios that agree, not single ones.

References

Lo Parrino, E., Falaschi, M., Manenti, R., Ficetola, G.F. (2023) All that changes is not shift: methodological choices influence niche shift detection in freshwater invasive species. Ecography 2023, e06432. doi:10.1111/ecog.06432

Broennimann, O. et al. (2012) Measuring ecological niche overlap from occurrence and spatial environmental data. Global Ecology and Biogeography 21, 481-497. doi:10.1111/j.1466-8238.2011.00698.x

Examples

# \donttest{
sim <- simulate_enm_data(seed = 1)
pres <- sim$presence
pres$group <- ifelse(pres$lon < 19, "west", "east")
os <- overlap_scenarios(pres, sim$env, thin_km = c(0, 30),
                        grids = c(50, 100), n_rep = 49, seed = 1)
os
#> Niche overlap across 8 scenarios (varying: space, thin_km, grid)
#> 
#> IN SHORT
#> - east vs west: D ranges from 0.19 to 0.20 across the scenarios (no or very
#>   limited overlap throughout).
#> - Equivalency test: the same verdict in all 8 scenarios (not equivalent):
#>   robust to these choices.
#> - Similarity of east to west: the same verdict in all 8 scenarios (less
#>   similar): robust to these choices.
#> - Similarity of west to east: the same verdict in all 8 scenarios (less
#>   similar): robust to these choices.
#> 
#>  background space thin_km grid group1 group2 n1 n2     D     I expansion
#>       whole   pca       0   50   east   west 54 46 0.185 0.383     0.919
#>       whole   raw       0   50   east   west 54 46 0.185 0.383     0.919
#>       whole   pca      30   50   east   west 49 42 0.195 0.396     0.922
#>       whole   raw      30   50   east   west 49 42 0.195 0.396     0.922
#>       whole   pca       0  100   east   west 54 46 0.186 0.384     0.922
#>       whole   raw       0  100   east   west 54 46 0.186 0.384     0.922
#>       whole   pca      30  100   east   west 49 42 0.196 0.398     0.925
#>       whole   raw      30  100   east   west 49 42 0.196 0.398     0.925
#>  unfilling eq_p    equivalency similarity_12 similarity_21
#>      0.942 0.02 not equivalent  less similar  less similar
#>      0.942 0.02 not equivalent  less similar  less similar
#>      0.941 0.02 not equivalent  less similar  less similar
#>      0.941 0.02 not equivalent  less similar  less similar
#>      0.944 0.02 not equivalent  less similar  less similar
#>      0.944 0.02 not equivalent  less similar  less similar
#>      0.946 0.02 not equivalent  less similar  less similar
#>      0.946 0.02 not equivalent  less similar  less similar
#> 
#> Verdicts at alpha = 0.05. A conclusion that holds in every scenario does not
#> depend on these choices; one that changes is a result of the choices as much
#> as of the organisms (Lo Parrino et al. 2023).
#> 
#> A preENM sensitivity analysis: how much the result depends on the
#> background and environmental space of the niche comparison. The others are
#> listed in ?sensitivity_analyses.
# }