test_points: Test points spatial balance against sets of random points

View source: R/balance_check.R

test_pointsR Documentation

Test points spatial balance against sets of random points

Description

Compare a set of points to sets of random points generated from the same polygon geometry and report back the proportion of random sets which had higher mean distance to nearest neighboring point. Assuming that a higher mean distance to nearest neighbor indicates greater spatial balance, this proportion can be treated as a "probabilty that the points in polygons are not spatially balanced." Whatever is provided as polygons will be dissolved without regard for the data slot, so if you want to test subsets of the polygons, each test will need to be a separate function call provided only the relevant subset as polygons, e.g. in the case of wanting to test individual strata stored as a single SPDF you would need to call this function for each stratum (probably in a lapply() or a loop).

Usage

test_points(
  number = 100,
  points,
  polygons,
  seed_number = 420,
  projection = "+proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0"
)

Arguments

number

Numeric. The number of sets to generate to compare. Defaults to 100.

points

Spatial Points Data Frame. The points that are being compared against.

polygons

Spatial Polygons Data Frame. Polygons describing the boundaries of the area of interest that corresponds to points.

seed_number

Numeric. The number to use in set.seed() for reproducibility. Defaults to 420.

projection

Character string. The projection to force all spatial objects into to for the purpose of compatibility. Defaults to "+proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0".

Value

Named numeric vector. The value for "p_arith" is the proportion of comparisons that had a higher arithmetic mean nearest neighbor distance than points and "p_geom" is the proportion of comparisons that had a higher geometric mean nearest neighbor distance.


nstauffer/sample.design documentation built on May 9, 2022, 3:21 a.m.