Description Usage Arguments Details Value Note Author(s) References See Also Examples
View source: R/contin_inhibit_sample.r
Draws a spatially continous sample of locations within a polygonal sampling region according to an "inhibitory plus close pairs" specification.
1 2 | contin.inhibit.sample(poly, size, delta, delta.fix = FALSE, k = 0,
rho = NULL, ntries = 10000, plotit = TRUE)
|
poly |
a |
size |
a non-negative integer giving the total number of locations to be sampled. |
delta |
minimum permissible distance between any two locations in preliminary sample. This can be allowed to vary with the number of |
delta.fix |
'logical' specifies whether |
k |
number of locations in preliminary sample to be replaced by near neighbours of other preliminary sample locations to form |
rho |
maximum distance between the two locations in a |
ntries |
number of rejected proposals after which the algorithm will terminate. |
plotit |
'logical' specifying if graphical output is required. Default is |
To draw a simple inhibitory (SI) sample of size n
from a spatially continuous region A, with the property that the distance between any two sampled locations is at least delta
, the following algorithm is used.
Step 1. Set i = 1 and generate a point x_{1} uniformly distributed on {\cal D}.
Step 2. Generate a point x uniformly distributed on {\cal D} and calculate the minimum, d_{\min}, of the distances from x_{i} to all x_{j}: j ≤q i .
Step 3. If d_{\min} ≥ δ, increase i by 1, set x_{i} = x and return to step 2 if i ≤ n, otherwise stop;
Step 4. If d_{\min} < δ, return to step 2 without increasing i.
Sampling close pairs of points.
For some purposes, it is desirable that a spatial sampling scheme include pairs of closely spaced points, resulting in an inhibitory plus close pairs (ICP) design. In this case, the above algorithm requires the following additional steps to be taken.
Let k be the required number of close pairs. Choose a value rho
such that a close pair of points will be a pair of points separated by a distance of at most rho
.
Step 5. Set j = 1 and draw a random sample of size 2 from integers 1, 2, …, n, say (i_1, i_2);
Step 6. Replace x_{i_{1}} by x_{i_{2}} + u , where u is uniformly distributed on the disc with centre x_{i_{2}} and radius rho
, increase i by 1 and return to step 5 if i ≤ k, otherwise stop.
When comparing a SI design to one of the ICP designs, the inhibitory components should have the same degree of spatial regularity. This requires δ to become a function of k namely
δ_{k} = δ_{0}√{n/(n - k)}
with δ_{0} held fixed.
a list with the following four components:
size:
the total number of sampled locations.
delta:
the value of δ after taking into account the number of close pairs k. If delta.fix = TRUE
, this will be δ input by the user.
k: the number of close pairs included in the sample (for inhibitory plus close pairs design).
sample.locs:
a sf
or sp
object containing coordinates of dimension n
by 2 containing the sampled locations.
If 'delta'
is set to 0, a completely random sample is generated. In this case, 'close pairs'
are not permitted and rho
is irrelevant.
Michael G. Chipeta mchipeta@mlw.mw
Peter J. Diggle p.diggle@lancaster.ac.uk
Chipeta M G, Terlouw D J, Phiri K S and Diggle P J. (2016b). Inhibitory geostatistical designs for spatial prediction taking account of uncertain covariance structure, Enviromentrics, pp. 1-11.
random.sample
and discrete.inhibit.sample
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | library("geoR")
library("sf")
data("parana")
poly <- parana$borders
poly <- matrix(c(poly[,1],poly[,2]),dim(poly)[1],2,byrow=FALSE)
#convert matrix to polygon
poly <- st_sf(st_sfc(st_polygon(list(as.matrix(poly)))))
#poly <- as(poly, "Spatial")
poly
# Generate spatially regular sample
set.seed(5871121)
xy.sample1 <- contin.inhibit.sample(poly=poly,size = 100, delta = 30, plotit = TRUE)
# Generate spatially regular sample with 10 close pairs
set.seed(5871122)
xy.sample2 <- contin.inhibit.sample(poly,size = 100, delta = 30,
k = 5, rho = 15, plotit = TRUE)
# Generate spatially regular sample with 10 close pairs
set.seed(5871123)
xy.sample3 <- contin.inhibit.sample(poly,size = 100, delta = 30, delta.fix = TRUE,
k = 10, rho = 15, plotit = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.