Skip to contents

A sensitivity table to choose thresholds: for each candidate threshold, the number of records it would remove among those that passed every other test (records kept, plus those removed only by the tests that use this column).

Usage

filter_sensitivity(
  x,
  column,
  thresholds,
  direction = c("above", "below"),
  by = NULL,
  reasons = NULL
)

Arguments

x

An occ_filter object.

column

Diagnostic column, e.g. "climate", "built_pct", "crop_pct", "ghs_mean_pct", "ghs_max_m2", "dist_land_m".

thresholds

Numeric vector of thresholds to try.

direction

"above": values at or above the threshold would be removed (default); "below": values at or below.

by

Optional grouping column (e.g. "countryCode"): counts are then also given per group.

reasons

Removal reasons whose records are also counted (default: the tests that use column).

Value

A data.frame (class filter_sensitivity) with threshold, removed and one column per group; printing it leads with the range of records removed across the thresholds, out of the records not removed by other tests.

Details

Status and limits. A preENM tool. It counts records, not their effect on a model: a threshold that removes few records can still remove those at the edge of the niche, so check where the removed records lie (see record_fate()).

References

Zizka, A., Silvestro, D., Andermann, T., et al. (2019) CoordinateCleaner: standardized cleaning of occurrence records from biological collection databases. Methods in Ecology and Evolution 10, 744-751. doi:10.1111/2041-210X.13152

Examples

occ <- data.frame(decimalLongitude = c(10, 11, 12), decimalLatitude = 46,
                  built = c(0.5, 4, 20))
res <- filter_occurrences(occ, filter_settings(cc_tests = "zeros"),
                           verbose = FALSE)
res$data$built_pct <- res$data$built     # normally added by a built layer
filter_sensitivity(res, "built_pct", c(1, 5, 10))
#> Records removed by `built_pct` under 3 thresholds
#> 
#> IN SHORT
#> - Every record was removed by other tests: there is nothing to judge.
#> 
#>  threshold removed
#>          1       0
#>          5       0
#>         10       0
#> 
#> A preENM sensitivity analysis: how much the result depends on the filter
#> threshold. The others are listed in ?sensitivity_analyses.