
Niche comparison and reporting
Source:vignettes/articles/niches-and-reporting.Rmd
niches-and-reporting.RmdComparing the niches of groups and reporting with ODMAP.
27. How different are the niches of two groups?
Comparing the niches of species, lineages, cytotypes or native and
introduced ranges follows Broennimann et al. (2012, Global Ecology
and Biogeography 21, 481-497), as in ecospat and ENMTools (Warren
et al. 2021, Ecography 44, 504-511).
niche_overlap() takes the records with a grouping column
(or a named list of tables) and the shared predictors:
no <- niche_overlap(records, env, group = "cytotype",
background = list(diploid = m_2x, tetraploid = m_4x),
n_rep = 100, seed = 1)
no # overlap, tests, in plain words
plot_niche_overlap(no, file = "niche_overlap.pdf")
plot_niche_overlap(no, limits = "niches") # zoom to the two niches
plot_niche_overlap(no, limits = c(-3, 3, -2, 2.5)) # same axes for several plotsBy default the plot shows all environments available to either group
(limits = "available"); limits = "niches"
zooms to the occupied envelopes of the pair, for niches much narrower
than the available environment, and four numbers set the window by hand.
The grid of the densities ends at the most extreme record or background
point, so the available environment can look cut off at the edges of the
plot: that is the edge of what was sampled, not of the species’
niche.

-
Space: a PCA of the pooled backgrounds of all
groups (the same PCA as
thin_environment()), or two raw predictors (space = "raw"). -
Densities: records and available environments are
smoothed with a Gaussian kernel on a
gridxgridlattice; the occupancy is the record density divided by the environment density, so that common environments do not look preferred. -
Overlap: Schoener’s D and the corrected Hellinger I
(Rodder and Engler 2011, Global Ecology and Biogeography 20,
915-927; the form used by ecospat and ENMTools), 0 = none, 1 =
identical, graded with Rodder and Engler’s classes (below 0.2 no or very
limited, …, above 0.8 very high); Levins’ breadth of each group. D, I
and breadth use the full densities, as ecospat does by default.
truncate = TRUEsets the densities outside the occupied envelope to 0 first (ecospat’sth.sp); in simulations with known overlap this lowered D in every case (a true D of 0.5 was estimated as 0.40 instead of 0.48 with 200 records per group, 0.32 instead of 0.46 with 20), so it is an option, not the default. -
Niche dynamics (Guisan et al. 2014, Trends in
Ecology & Evolution 29, 260-269): expansion, stability and
unfilling of the second group relative to the first, within environments
available to both; the occupied envelope holds 95% of the records
(
marginal_records), rare environments can be left out withmarginal_env. - Tests with null distributions, p-values and standardised effect sizes: equivalency (records pooled and re-split) and similarity in both directions (one group against random points of the other’s background).
-
Geographic space:
predictions(one suitability raster per group) adds D, I and the rank correlation of the model predictions, as the first ENMTools did (prediction_overlap()); they depend on the area mapped, so niches are better compared in environmental space.
Is the conclusion robust? Background, variables,
space and thinning can decide whether a niche shift is found at all (Lo
Parrino et al. 2023, Ecography 2023, e06432).
overlap_scenarios() repeats the analysis over a grid of
such choices and says whether each verdict holds in every scenario or
which choice changes it:
28. Reporting with ODMAP
odmap_table() writes the entries of the ODMAP protocol
(Zurell et al.
- that your workflow determines, from the objects themselves, and leaves the others for you:
od <- odmap_table(filter = res, m = m, thinning = th, records = occ_final,
background = bg, variables = vs, predictors = names(env),
truncation = tr, block_size = bs, folds = pts$fold,
evaluation = ev, selection = sel,
fields = list("Study title" = "...", "Focal Taxon" = "..."),
file = "odmap.csv")