Title: | Inhibitory with close pairs sampling |
---|---|
Description: | Implements various methods for sampling inhibitory points with a number of close pairs. |
Authors: | Barry Rowlingson [aut, cre] , Mélodie Sammarro [aut] |
Maintainer: | Barry Rowlingson <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.1.1.0 |
Built: | 2024-10-30 04:45:55 UTC |
Source: | https://gitlab.com/b-rowlingson/sidclosepairs |
Add close pair points to a set of points.
add_close_pairs(ptsxy, n_close_pairs, poly, zeta)
add_close_pairs(ptsxy, n_close_pairs, poly, zeta)
ptsxy |
spatial point data frame or matrix of coordinates |
n_close_pairs |
number of close pair points to generate |
poly |
sf-class polygon object |
zeta |
Close point radius |
This function adds close pair points to any set of points. It is used
internally by the icpSample
function but can be used to add close
pairs to any set of points.
Each close point is generated randomly uniformly within the disc of radius
zeta
from a randomly selected initial point, without replacement, so that
initial points cannot have more than one close point generated.
spatial point data frame or coordinate matrix with all points
Barry Rowlingson, Melodie Sammarro
Generate a set of points based on a set of initial inhibitory points with some number of close pair points added to them.
icpSample(n, k, delta, zeta, poly, proposal = "", rdensity, censusxy)
icpSample(n, k, delta, zeta, poly, proposal = "", rdensity, censusxy)
n |
Total number of output points |
k |
Number of close pairs |
delta |
Inhibitory radius |
zeta |
Close point radius |
poly |
sf-class polygon object |
proposal |
Method for generating primary points |
rdensity |
Raster for "density" method |
censusxy |
x-y matrix for "census" method |
This function generates a set of inhibitory close-pairs points by first generating initial points from one of the proposal methods,
There are three "proposal" methods for generating the initial inhibitory points - the default uniform randomly in a polygon, "density", which uses a by density specified by a raster, and "census", which samples from a (typically dense) set of points such as a full census of an area. The initial points are guaranteed to be at least further than the delta parameter apart, and the close pair points will be uniformly in a circle of radius zeta around a random initial point. Note this can result in output points being closer than the delta distance.
The retrned data frame will contain the inhibitory points first, but there is no relation between the close pair points and the inhibitory points returned. A relation can be inferred if the inhibitory points are far enough away but this is not always possible if the inhibitory distance is close to the close point distance.
The initial inhibitory points are generated by an iterative process that is not guaranteed to terminate, and in fact could be guaranteed to not terminate for relatively large inhibitory distances in a small area. For guaranteeing termination, the code may need to be wrapped in a "timeout" function. See the vignettes for an example.
spatial data frame of points
Barry Rowlingson, Melodie Sammarro
Generate inhibitory close pairs spread evenly across multiple polygons
icpSampleM(n, k, delta, zeta, poly)
icpSampleM(n, k, delta, zeta, poly)
n |
Total number of output points |
k |
Number of close pairs |
delta |
Inhibitory radius |
zeta |
Close point radius |
poly |
sf-class polygon data frame |
This function operates similarly to icpSample
except it splits the
initial points evenly across multiple polygons. If the number of
points is not a multiple of the number of polygons then a warning
is generated and an uneven partition is used.
a spatial points data frame
Barry Rowlingson, Melodie Sammarro