Learn R Programming

S4DM (version 0.0.1)

evaluate_range_map: Evaluate S4DM range map quality

Description

This function uses 5-fold, spatially stratified, cross-validation to evaluate distribution model quality.

Usage

evaluate_range_map(
  occurrences,
  env,
  method = NULL,
  presence_method = NULL,
  background_method = NULL,
  bootstrap = "none",
  bootstrap_reps = 100,
  quantile = 0.05,
  constraint_regions = NULL,
  background_buffer_width = NULL,
  standardize_preds = TRUE,
  ...
)

Value

A list containing 1) a data.frame containing cross-validated model performance statistics (fold_results), and 2) a data.frame containing model performance statistics evaluated on the full dataset (overall_results).

Arguments

occurrences

Presence coordinates in long,lat format.

env

Environmental SpatRaster(s)

method

Optional. If supplied, both presence and background density estimation will use this method.

presence_method

Optional. Method for estimation of presence density.

background_method

Optional. Method for estimation of background density.

bootstrap

Character. One of "none" (the default, no bootstrapping), "numbag" (presence function is bootstrapped), or "doublebag" (presence and background functions are bootstrapped).

bootstrap_reps

Integer. Number of bootstrap replicates to use (default is 100)

quantile

Quantile to use for thresholding. Default is 0.05 (5 pct training presence). Set to 0 for minimum training presence (MTP).

constraint_regions

See get_env_bg documentation

background_buffer_width

Numeric or NULL. Width (meters or map units) of buffer to use to select background environment. If NULL, uses max dist between nearest occurrences.

standardize_preds

Logical. Should environmental layers be scaled? Default is TRUE.

...

Additional parameters passed to internal functions.

Details

Current plug-and-play methods include: "gaussian", "kde","vine","rangebagging", "lobagoc", and "none". Current density ratio methods include: "ulsif", "rulsif".

Examples

Run this code
{

# load in sample data

 library(S4DM)
 library(terra)

 # occurrence points
   data("sample_points")
   occurrences <- sample_points

 # environmental data
   env <- rast(system.file('ex/sample_env.tif', package="S4DM"))

 # rescale the environmental data

   env <- scale(env)

# Evaluate a gaussian/gaussian model calculated with the numbag approach
# using 10 bootstrap replicates.

 evaluate_range_map(occurrences = occurrences,
                    env = env,
                    method = NULL,
                    presence_method = "gaussian",
                    background_method = "gaussian",
                    bootstrap = "numbag",
                    bootstrap_reps = 10,
                    quantile = 0.05,
                    constraint_regions = NULL,
                    background_buffer_width = 100000)



}

Run the code above in your browser using DataLab