tgb_sample: Sample target-group background sites

View source: R/s2bak_tgb.R

tgb_sampleR Documentation

Sample target-group background sites

Description

This function samples background sites used in species distribution modelling (SDM), using the target-group background (TGB) sampling method.

Sites are sampled, weighted by the number of sightings found in obs.

Usage

tgb_sample(obs, nbackground = 10000)

Arguments

obs

Species observations as a data.frame, with a column for species name (must be labelled 'species') and column of index of observations to reflect presences. If the index column name is not found in 'data', it assumes row number.

nbackground

The number of background sites to sample. If the number of sites specified is less than the available sites in data, then the maximum will be sampled.

Value

A vector of indices corresponding to the data argument, which can be used to fit SDMs through link[s2bak]fit.s2bak, fit.s2bak.so and fit.s2bak.s2

Examples

## See ?fit.s2bak


leung-lab/s2bak documentation built on March 1, 2023, 9:10 a.m.