View source: R/balance_check.R
test_points | R Documentation |
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).
test_points( number = 100, points, polygons, seed_number = 420, projection = "+proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0" )
number |
Numeric. The number of sets to generate to compare. Defaults to |
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 |
seed_number |
Numeric. The number to use in |
projection |
Character string. The projection to force all spatial objects into to for the purpose of compatibility. Defaults to |
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.