sptst
Andresen’s spatial point pattern test
sptst(a, b, nboot = 200, seed = NULL, alpha = 0.05, scale = 100)Compares where two point patterns fall over the same areal units
(Andresen 2009): for each unit, the difference between its share of the
test pattern b and its share of the base pattern a, with a bootstrap
p-value from multinomial resamples of each pattern; the S index is the
share of units whose difference is not significant (1: the patterns are
alike everywhere).
Parameters
Section titled “Parameters”a, bThe counts of the base and the test pattern by unit: whole numbers from 0;
NAin either leaves the unit out (counted, never taken as 0).nbootThe number of bootstrap resamples: a whole number from 1.
seedNULLto draw the simulations’ seed from R’s generator (soset.seed()fixes them), or one whole number from 0.alphaThe level of each unit’s test, strictly between 0 and 1.
scaleThe multiplier of the differences (100: percentage points).
Returns
Section titled “Returns”A list: units, a data frame with one row per unit of diff, p
and flag (the sign of a significant difference, 0 otherwise; NaN
without a p-value); glob, a named vector: units left out, empty in
both, eligible and flagged, the S index s, its z against
1 - alpha, the exact p of so many flags and nboot.
References
Section titled “References”Andresen, M. A. (2009). Testing for similarity in area-based spatial patterns: a nonparametric Monte Carlo approach. Applied Geography, 29(3), 333-345. doi:10.1016/j.apgeog.2008.12.004
Examples
Section titled “Examples”set.seed(1)a <- rpois(30, 10)b <- rpois(30, 10)sptst(a, b, nboot = 199, seed = 1)$globGenerated from the R help page: sptst in the R reference.