Closes the loop of jitter_uncertainty(): given one prediction raster
per replicate dataset (the same model, settings and predictors, fitted
to each replicate), returns the per-cell mean, standard deviation and
coefficient of variation. Because only the positions of the records
differ between the replicates, the spread is the part of the prediction
uncertainty due to coordinate error alone. It is computed in the same
way as the disagreement layer of ensemble_models() (the replicates
play the role of the models, combined by their mean), so the two can be
compared cell by cell: with ensemble, the summary says where
coordinate error moves the predictions more than the choice of model.
Usage
coordinate_spread(
predictions,
ensemble = NULL,
levels = c(0.05, 0.1),
n_sample = 1e+05,
rescale = TRUE,
filename = NULL,
overwrite = FALSE,
pattern = "\\.tif{1,2}$",
recursive = FALSE,
seed = 1
)Arguments
- predictions
One prediction raster per replicate: a terra::SpatRaster, raster files or a folder.
- ensemble
Optional result of
ensemble_models()on the same grid, for the comparison with the disagreement between models.- levels
Levels of
sdfor the area summary (for predictions on the 0-1 scale).- n_sample
Cells sampled for the summaries.
- rescale
Bring all predictions to the 0-1 scale first (see
ensemble_models()).- filename
Optional file for the raster (layers
mean,sd,cv).- overwrite
Overwrite
filename.- pattern, recursive
File search in folders.
- seed
Seed of the cell sample.
Value
An object of class coordinate_spread: raster (layers
mean, sd, cv), summary, area, comparison (with
ensemble), n_replicates and n_sample. See
plot_coordinate_spread().
Details
Status and limits. A preENM summary. The spread covers only the
coordinate error represented in the replicates of jitter_uncertainty();
with few replicates the standard deviation is itself uncertain.
References
Gabor, L. et al. (2023) Species distribution models affected by positional uncertainty in species occurrences can still be ecologically interpretable. Ecography 2023, e06358. doi:10.1111/ecog.06358
Examples
sim <- simulate_enm_data(seed = 1)
# stand-ins for predictions from models fitted to 5 jittered replicates
reps <- c(sim$models[[1]], sim$models[[1]] * 0.95,
sim$models[[1]] * 0.9 + 0.05, sim$models[[1]] * 0.98,
sim$models[[1]] * 0.92 + 0.02)
cs <- coordinate_spread(reps, ensemble = ensemble_models(sim$models))
cs
#> Prediction spread from coordinate error: 5 replicate predictions
#>
#> IN SHORT
#> - Moving the records within their coordinate uncertainty changes the
#> predictions by a median standard deviation of 0.021 per cell (90% of
#> cells below 0.025): small on the 0-1 scale.
#> - Cells with sd above 0.05: 0% of the area (0 km2).
#> - Cells with sd above 0.1: 0% of the area (0 km2).
#> - Compared with the disagreement between models (median sd 0.244),
#> coordinate error moves the predictions more in 0% of the cells (median
#> ratio 0.079). The choice of model is the larger source here.
#> - Only 5 replicates: the spread is uncertain; 10 or more are better.
#>
#> statistic median q90 q99 max
#> sd 0.0214 0.0249 0.025 0.0251
#> cv 0.0259 0.3648 1.475 1.5584
#>
#> sd and cv are computed per cell over the replicate predictions as in
#> ensemble_models(); the replicates differ only in the positions of the
#> records, so the spread is due to coordinate error alone. The grades (median
#> sd below 0.02 negligible, 0.05 small, 0.1 moderate) are preENM defaults for
#> predictions on the 0-1 scale, not from the literature.
#>
#> A preENM sensitivity analysis: how much the result depends on where
#> imprecise records really lie. The others are listed in
#> ?sensitivity_analyses.
plot_coordinate_spread(cs)
