Skip to contents

A target-group background corrects sampling bias only if the records of the target group were collected in the same way as those of the focal species: in the same places, in the same years, by the same kind of recording (Phillips et al. 2009). A group recorded mostly as herbarium specimens is a poor target for citizen-science observations, and a group recorded mainly before 1950 for recent records. target_group_check() compares the two sets of records on the three accounts:

Usage

target_group_check(
  focal,
  target,
  year = "year",
  basis = "basisOfRecord",
  grid_km = 10,
  coords = NULL,
  points_crs = "EPSG:4326"
)

Arguments

focal, target

Records of the focal species and of the target group: data frames with coordinates (and optionally year and basis columns), CSV paths, sf or SpatVector. The focal records may be part of the target group.

year, basis

Column names of the year and the kind of record (set to NULL to skip a comparison; skipped when a column is missing).

grid_km

Cell size (km) of the grid for the spatial comparison.

coords

Coordinate columns (guessed if NULL).

points_crs

CRS of the coordinates.

Value

An object of class target_group_check: summary (one row per account: measure, value, grade), years and basis (the distributions compared, or NULL), distance_km (nearest target record for each focal record) and settings.

Details

  • Space: the share of focal records whose grid cell (grid_km, in an equal-area projection) also holds target records, and the distance from each focal record to the nearest target record.

  • Time (year): the Kolmogorov-Smirnov distance between the distributions of years, and the share of focal records within the 5th to 95th percentile of the target's years.

  • Kind of record (basis, e.g. GBIF basisOfRecord): the total variation distance between the shares of each kind (0 = the same mix, 1 = no kind in common).

Status and limits. A preENM check of an assumption of the target-group method (Phillips et al. 2009). It compares where, when and how records were made, not who made them or with what effort; matching on these three does not prove the same observation process, but a clear mismatch shows a different one. The grades (space: at least 90% / 70% of focal records in cells with target records; time: KS distance at most 0.2 / 0.4; kind of record: distance at most 0.2 / 0.4) are preENM defaults, not from the literature. What to vary. grid_km (a coarse grid hides gaps that a fine one shows) and the definition of the target group (genus, family, recorders).

References

Phillips, S.J., Dudik, M., Elith, J., Graham, C.H., Lehmann, A., Leathwick, J., Ferrier, S. (2009) Sample selection bias and presence-only distribution models: implications for background and pseudo-absence data. Ecological Applications 19, 181-197. doi:10.1890/07-2153.1

See also

sample_background() with method = "target_group", gbif_target_group_sql()

Examples

set.seed(1)
target <- data.frame(lon = runif(2000, 10, 20), lat = runif(2000, 45, 50),
                     year = sample(1950:2020, 2000, replace = TRUE),
                     basisOfRecord = sample(c("HUMAN_OBSERVATION",
                                              "PRESERVED_SPECIMEN"), 2000,
                                            replace = TRUE))
focal <- target[sample(2000, 150), ]
target_group_check(focal, target)
#> Target group check: 150 focal and 2000 target records
#> 
#> IN SHORT
#> - The target group was recorded where, when and how the focal species was:
#>   a target-group background can correct the focal species' sampling bias.
#> - 100% of the focal records lie in 10 km cells with target records; median
#>   distance to the nearest target record 0 km.
#> - Median year: focal 1984, target 1984; 91% of the focal records fall
#>   within the target's 5th-95th percentile of years.
#> 
#>         account                                             measure value grade
#>           space share of focal records in cells with target records  1.00  same
#>            time                Kolmogorov-Smirnov distance of years  0.05  same
#>  kind of record            total variation distance of record kinds  0.01  same
#> 
#> Grades: space same at >= 90% of focal records in cells with target records,
#> partly at >= 70%; time and kind of record same at a distance <= 0.2, partly
#> at <= 0.4. preENM defaults, not from the literature. Matching where, when
#> and how does not prove the same observation process; a mismatch shows a
#> different one.
# a focal species recorded recently by observers only
focal2 <- focal
focal2$year <- sample(2010:2024, 150, replace = TRUE)
focal2$basisOfRecord <- "HUMAN_OBSERVATION"
tg <- target_group_check(focal2, target)
tg
#> Target group check: 150 focal and 2000 target records
#> 
#> IN SHORT
#> - The target group was recorded differently in time and kind of record: its
#>   records do not show the focal species' observation process, and a
#>   target-group background may add a bias instead of removing one. Choose a
#>   group recorded like the focal species, or compare with other backgrounds.
#> - 100% of the focal records lie in 10 km cells with target records; median
#>   distance to the nearest target record 0 km.
#> - Median year: focal 2016, target 1984; 56% of the focal records fall
#>   within the target's 5th-95th percentile of years.
#> 
#>         account                                             measure value
#>           space share of focal records in cells with target records  1.00
#>            time                Kolmogorov-Smirnov distance of years  0.85
#>  kind of record            total variation distance of record kinds  0.50
#>      grade
#>       same
#>  different
#>  different
#> 
#> Grades: space same at >= 90% of focal records in cells with target records,
#> partly at >= 70%; time and kind of record same at a distance <= 0.2, partly
#> at <= 0.4. preENM defaults, not from the literature. Matching where, when
#> and how does not prove the same observation process; a mismatch shows a
#> different one.
plot_target_group(tg)