Skip to contents

Data preparation

Functions for sampling background/pseudo-absences points and thinning the data.

sample_background()
Sample background points for SDM analysis
sample_background_time()
Sample background points for SDM analysis for points with a time point.
sample_pseudoabs()
Sample pseudo-absence points for SDM analysis
sample_pseudoabs_time()
Sample pseudo-absence points for SDM analysis for points with a time point.
thin_by_cell()
Thin point dataset to have 1 observation per raster cell
thin_by_cell_time()
Thin point dataset to have 1 observation per raster cell per time slice
thin_by_dist()
Thin points dataset based on geographic distance
thin_by_dist_time()
Thin points dataset based on geographic and temporal distance

Choice of predictor variables

Functions for removing collinearity and visualising the distribution of predictors.

filter_collinear()
Filter to retain only variables that have low collinearity
plot_pres_vs_bg()
Plot presences vs background
geom_split_violin()
Split violin geometry for ggplots
dist_pres_vs_bg()
Distance between the distribution of climate values for presences vs background

Recipes

Functions for recipes with spatial SDM data (additional steps can be added with standard recipes functions).

recipe(<sf>) spatial_recipe()
Recipe for sf objects
check_sdm_presence()
Check that the column with presences is correctly formatted

Models specification

Predefined model specifications (custom models can be added with standard parsnip model specifications).

sdm_spec_glm()
Model specification for a GLM for SDM
sdm_spec_gam()
Model specification for a GAM for SDM
gam_formula()
Create a formula for gam
sdm_spec_rand_forest() sdm_spec_rf()
Model specification for a Random Forest for SDM
sdm_spec_boost_tree()
Model specification for a Boosted Trees model for SDM
sdm_spec_maxent()
Model specification for a MaxEnt for SDM
maxent()
MaxEnt model
regularization_multiplier() feature_classes()
Parameters for maxent models

Data splitting

Functions for splitting the data into folds (in additiona to standard spatialsample functions.

spatial_initial_split()
Simple Training/Test Set Splitting for spatial data
blockcv2rsample()
Convert an object created with blockCV to an rsample object
check_splits_balance()
Check the balance of presences vs pseudoabsences among splits
autoplot(<spatial_initial_split>)
Create a ggplot for a spatial initial rsplit.
grid_offset()
Get default grid cellsize for a given dataset
grid_cellsize()
Get default grid cellsize for a given dataset

Metrics

Specialised metrics for SDM, and methods of metrics from yardstick adapted to work on sf objects

sdm_metric_set()
Metric set for SDM
optim_thresh()
Find threshold that optimises a given metric
boyce_cont() boyce_cont_vec()
Boyce continuous index (BCI)
kap_max() kap_max_vec()
Maximum Cohen's Kappa
tss_max() tss_max_vec()
Maximum TSS - True Skill Statistics
tss()
TSS - True Skill Statistics
average_precision(<sf>) brier_class(<sf>) classification_cost(<sf>) gain_capture(<sf>) mn_log_loss(<sf>) pr_auc(<sf>) roc_auc(<sf>) roc_aunp(<sf>) roc_aunu(<sf>)
Probability metrics for sf objects

Ensemble

Functions for creating an ensemble selecting the best set of parameters for each model.

simple_ensemble()
Simple ensemble
autoplot(<simple_ensemble>)
Plot the results of a simple ensemble
repeat_ensemble()
Repeat ensemble
add_member()
Add best member of workflow to a simple ensemble
add_repeat()
Add repeat(s) to a repeated ensemble
collect_metrics(<simple_ensemble>) collect_metrics(<repeat_ensemble>)
Obtain and format results produced by tuning functions for ensemble objects
control_ensemble_grid() control_ensemble_resamples() control_ensemble_bayes()
Control wrappers
explain_tidysdm()
Create explainer from your tidysdm ensembles.

Project SDM to present, past and future

Functions for making predictions.

calib_class_thresh()
Calibrate class thresholds
predict(<repeat_ensemble>)
Predict for a repeat ensemble set
predict(<simple_ensemble>)
Predict for a simple ensemble set
predict_raster()
Make predictions for a whole raster

Managing extrapolation

Functions for managing extrapolation.

clamp_predictors()
Clamp the predictors to match values in training set
extrapol_mess()
Multivariate environmental similarity surfaces (MESS)

Other

Additional helpful functions.

niche_overlap()
Compute overlap metrics of the two niches
km2m()
Convert a geographic distance from km to m
y2d()
Convert a time interval from years to days
filter_high_cor()
Deprecated: Filter to retain only variables below a given correlation threshold

Example data

Example datasets and simple models used in the documentation

horses
Coordinates of radiocarbon dates for horses
lacerta
Coordinates of presences for Iberian emerald lizard
lacertidae_background
Coordinates of presences for lacertidae in the Iberian peninsula
lacerta_ensemble
A simple ensemble for the lacerta data
lacerta_rep_ens
A repeat ensemble for the lacerta data