Package 'biasProxyR'

Title: Sampling Effort Proxies for Species Distribution Models
Description: Addresses geographic sampling bias in Species Distribution Models (SDMs) for data-poor regions. It generates sampling effort proxies using open-source infrastructure data, allowing researchers to sample bias-aware background points. This prevents models from learning sampling artifacts instead of true ecological niches.
Authors: Aamna Naveed [aut, cre]
Maintainer: Aamna Naveed <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2026-11-18 14:28:12 UTC
Source: https://github.com/cran/biasProxyR

Help Index


Diagnose Sampling Bias in Occurrence Data

Description

Plots occurrence points over a sampling effort proxy surface and calculates a "Bias Correlation Score" to quantify how much the data is skewed toward human infrastructure.

Usage

diagnose_sampling_bias(occurrences, effort_surface)

Arguments

occurrences

An sf object containing occurrence points.

effort_surface

A SpatRaster object representing sampling effort.

Value

A list containing the bias score (percentage) and a diagnostic message.

Examples

if (requireNamespace("rnaturalearthdata", quietly = TRUE) &&
      requireNamespace("osmdata", quietly = TRUE) &&
      curl::has_internet()) {
    try({
      effort <- generate_effort_surface("Luxembourg", resolution = 1000)
      bg_points <- sample_bias_aware_background(effort, n_points = 100)
      diagnose_sampling_bias(bg_points, effort)
    }, silent = TRUE)
  }

Generate a Sampling Effort Proxy Surface

Description

Downloads road data for a given country and calculates distance to roads to create a proxy for human sampling effort.

Usage

generate_effort_surface(country = "Pakistan", resolution = 10000)

Arguments

country

Character. Name of the country (e.g., "Pakistan").

resolution

Numeric. Output raster resolution in meters (default = 10000).

Value

A SpatRaster object where higher values indicate higher probability of human sampling effort (closer to roads).


Sample Bias-Aware Background Points

Description

Generates background points for Species Distribution Models (SDMs) that are weighted by a sampling effort proxy surface. This cancels out geographic sampling bias in data-poor regions.

Usage

sample_bias_aware_background(effort_surface, n_points = 10000)

Arguments

effort_surface

A SpatRaster object representing sampling effort (e.g., from generate_effort_surface).

n_points

Numeric. The number of background points to generate (default = 10000).

Value

An sf object containing the sampled background points.

Examples

if (requireNamespace("rnaturalearthdata", quietly = TRUE) &&
      requireNamespace("osmdata", quietly = TRUE) &&
      curl::has_internet()) {
    try({
      effort <- generate_effort_surface("Luxembourg", resolution = 1000)
      bg_points <- sample_bias_aware_background(effort, n_points = 1000)
    }, silent = TRUE)
  }