make_range_map: Make a range map using plug-and-play modeling.

View source: R/make_range_map.R

make_range_mapR Documentation

Make a range map using plug-and-play modeling.

Description

This function produces range maps using plug-and-play modeling with either presence-background or density-ratio approaches.

Usage

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

Arguments

occurrences

Presence coordinates in long,lat format.

env

Environmental rasters

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), set to NULL to return continuous raster.

background_buffer_width

The width (in m for unprojected rasters and map units for projected rasters) of the buffer to use for background data. Defaults to NULL, which will take the maximum distance between occurrence records.

constraint_regions

See get_env_bg documentation

verbose

Logical. If TRUE, prints progress messages.

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",and "maxnet".

Value

A SpatRaster object containing a range map. Maps may be either binary or continuous, depending upon the quantile argument.

Note

Either method or both presence_method and background_method must be supplied.

Examples

{

# 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)

   map <- make_range_map(occurrences = occurrences,
                         env = env,
                         method = "gaussian",
                         presence_method = NULL,
                         background_method = NULL,
                         bootstrap = "none",
                         bootstrap_reps = 100,
                         quantile = 0.05,
                         background_buffer_width = 100000)

   plot(map)


}

bmaitner/pbsdm documentation built on Feb. 8, 2025, 2:27 p.m.