Learn R Programming

geosample (version 0.2.1)

contin.inhibit.sample: Spatially continuous sampling

Description

Draws a spatially continous sample of locations within a polygonal sampling region according to an "inhibitory plus close pairs" specification.

Usage

contin.inhibit.sample(poly, size, delta, delta.fix = FALSE, k = 0,
  rho = NULL, ntries = 10000, plotit = TRUE)

Arguments

poly

a sf or sp polygon in which to generate the design.

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 'close pairs' if a simple inhibitory design is compared to one of the inhibitory plus close pairs design.

delta.fix

'logical' specifies whether delta is fixed or allowed to vary with number of close pairs \(k\). Default is delta.fix = FALSE.

k

number of locations in preliminary sample to be replaced by near neighbours of other preliminary sample locations to form close pairs (integer between 0 and size/2). A simple inhibitory deisgn is generated when \(k = 0\).

rho

maximum distance between the two locations in a 'close-pair'.

ntries

number of rejected proposals after which the algorithm will terminate.

plotit

'logical' specifying if graphical output is required. Default is plotit = TRUE.

Value

a list with the following four components:

size: the total number of sampled locations.

delta: the value of \(\delta\) after taking into account the number of close pairs \(k\). If delta.fix = TRUE, this will be \(\delta\) 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.

Details

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 \leq i \).

  • Step 3. If \(d_{\min} \ge \delta\), increase \(i\) by 1, set \(x_{i} = x\) and return to step 2 if \(i \le n\), otherwise stop;

  • Step 4. If \(d_{\min} < \delta\), 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, \ldots, 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 \le 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 \(\delta\) to become a function of \(k\) namely $$\delta_{k} = \delta_{0}\sqrt{n/(n - k)}$$ with \(\delta_{0}\) held fixed.

References

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.

See Also

random.sample and discrete.inhibit.sample

Examples

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab