Learn R Programming

glossa (version 1.2.4)

generate_pa_env_space_flexsdm: Generate Environmental-space Pseudo-Absences via flexsdm (per temporal stratum)

Description

Uses flexsdm::sample_pseudoabs(method = c("env_const", env = predictors) within each timestamp stratum so that pseudo-absences match the temporal distribution of presences. Extracts covariate values for the sampled coordinates and returns a data.frame with the same predictor columns.

Usage

generate_pa_env_space_flexsdm(
  presences,
  raster_stack,
  predictor_variables,
  coords = c("decimalLongitude", "decimalLatitude"),
  ratio = 1,
  attempts = 100,
  seed = NULL
)

Value

A data frame of pseudo-absences with coordinates, timestamp, `pa = 0`, and covariate values.

Arguments

presences

Data frame containing presence points.

raster_stack

`SpatRaster` object containing covariate data. Uses continuous predictor only and samples per timestamp.

predictor_variables

Character vector of the predictor variables selected for this species.

coords

Character vector specifying the column names for latitude and longitude. Defaults to `c("decimalLongitude", "decimalLatitude")`.

ratio

Ratio of pseudo-absences to presences (default 1 = balanced).

attempts

Integer specifying the number of attempts to generate exact pseudo-absences. Defaults to 100.

seed

Optional seed for reproducibility.