check_balance: Test to see if a set of points are spatially balanced within...

View source: R/balance_check.R

check_balanceR Documentation

Test to see if a set of points are spatially balanced within the polygons used to draw them

Description

Given a set of points and the polygons used to draw them, test the spatial balance of the point by comparing them to randomly located points generated within the polygons

Usage

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

Arguments

polygons

Polygon sf object. The polygons that were used to draw the points. This can either be the sample frame for the points or stratification polygons.

points

Point sf object. The points to be tested for spatial balance.

reps

Numeric. The number of random draws to make to compare against points. If this is larger than 100 then the process can start to take more than a few minutes if points contains more than a few dozen points. Defaults to 100.

seed_number

Numeric. The number to supply to set.seed() for reproducibility. At multiple steps, this seed number may be used to generate additional seed numbers for function-internal use, but always reproducibly. Defaults to 420.

projection

CRS string or object. 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".

method

Character string. Which method to use for generating random sets of points to compare against. Either "sample" to use sf::st_sample() which is the much faster option or "probability" which uses a legacy approach that depends on cumulative proportional areas of subpolygons as probability of selection for random points. Defaults to "sample".

Value

A data frame with the variables polygon, point_count (Number of points from points occurring in the polygon), reps (Number of random draws compared against), mean_arithmetic (The arithmetic mean of the nearest neighbor distances for the points in points), mean_geometric (The geometric mean of the nearest neighbor distances for the points in points), p_arithmetic (The proportion of random point draws that had larger arithmetic mean neighbor distances than points), and p_geometric (The proportion of random point draws that had larger geometric mean neighbor distances than points). We treat the p_geometric as the p value for testing the H0 that points is balanced.


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