discrete.inhibit.sample: Spatially discrete sampling

Description Usage Arguments Details Value Note Author(s) References Examples

View source: R/discrete_inhibit_sample.r

Description

Draw a spatially discrete sample from a specified set of spatial locations within a polygonal sampling region according to an "inhibitory plus close pairs" specification.

Usage

1
2
3
discrete.inhibit.sample(obj, size, delta, delta.fix = FALSE, k = 0,
  cp.criterion = NULL, zeta, ntries = 10000, poly = NULL,
  plotit = TRUE)

Arguments

obj

a sf or sp object where each line corresponds to a spatial location containing values of two-dimensional coordinates and, optionally, the values of one or more associated values, typically an outcome of interest and any associated covariates.

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 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 close-pair locations in the sample. Must be an integer between 0 and size/2.

cp.criterion

criterion for choosing close pairs k. The "cp.zeta" criterion chooses locations not included in the initial sample, from the uniform distribution of a disk with radius 'zeta' (NB: zeta argument must be provided for this criterion). The "cp.neighb" criterion chooses nearest neighbours amongst locations not included in the initial sample ('zeta' becomes trivial for 'cp.neighb' criterion).

zeta

maximum permissible distance (radius of a disk with center x^{*}_{j}, j = 1, …, k) within which a close-pair point is placed. See Details.

ntries

number of rejected proposals after which the algorithm terminates.

poly

'optional', a sf or sp polygon object in which the design sits. The default is the bounding box of points given by obj.

plotit

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

Details

To draw a sample of size n from a population of spatial locations X_{i} : i = 1,…,N, with the property that the distance between any two sampled locations is at least δ, the function implements the following algorithm.

Samples generated in this way exhibit more regular spatial arrangements than would random samples of the same size. The degree of regularity achievable will be influenced by the spatial arrangement of the population X_{i} : i = 1,…,N, the specified value of δ and the sample size n. For any given population, if n and/or δ is too large, a sample of the required size with the distance between any two sampled locations at least δ will not be achievable; the algorithm will then find n_{s} < n points that can be placed for the given parameters.

Sampling close pairs of points.

For some purposes, typically when using the same sample for parameter estimation and spatial prediction, it is desirable that a spatial sampling scheme include pairs of closely spaced points x. The function offers two ways of specifying close pairs, either as the closest available unsampled point to an existing sampled point (cp.critetrion = cp.neighb), or as a random choice from amongst all available unsampled points within distance zeta of an existing sampled point (cp.criterion = cp.zeta). The algorithm proceeds as follows.

Let k be the required number of close pairs.

Note: Depending on the spatial configuration of potential sampling locations and, when the selection criterion cp.criterion = cp.zeta, the specified value of zeta, it is possible that one or more of the selected points x_{j} in Step 2 will not have an eligible “close pair”. In this case, the algorithm will try find an alternative x_{j} and report a warning if it fails to do so.

Value

a list with the following four components:

unique.locs: the number of unique 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 the final sampled locations and any associated values.

Note

If 'delta' is set to 0, a completely random sample is generated. In this case, 'close pairs' are not permitted and 'zeta' becomes trivial.

Author(s)

Michael G. Chipeta mchipeta@mlw.mw

Peter J. Diggle p.diggle@lancaster.ac.uk

References

Chipeta M G, Terlouw D J, Phiri K S and Diggle P J. (2016). Inhibitory geostatistical designs for spatial prediction taking account of uncertain covariance structure, Enviromentrics, pp. 1-11.

Diggle P J. (2014). Statistical Analysis of Spatial and Spatio-Temporal Point Patterns. 3rd ed., Boca Raton: CRC Press

Diggle P J and Lophaven S. (2006). Bayesian geostatistical design, Scandinavian Journal of Statistics 33(1) pp. 53 - 64.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
library("sf")
set.seed(1234)
x <- 0.015+0.03*(1:33)
xall <- rep(x,33)
yall <- c(t(matrix(xall,33,33)))
xy <- cbind(xall,yall)+matrix(-0.0075+0.015*runif(33*33*2),33*33,2)


# Convert to SF object
xy <- xy %>%
  as.data.frame %>%
  sf::st_as_sf(coords = c(1,2))


# Plot the points
plot(st_geometry(xy),pch=19,cex=0.25,xlab="longitude",ylab="latitude",
     cex.lab=1,cex.axis=1,cex.main=1, axes = TRUE)


# Generate spatially random sample
set.seed(15892)
xy.sample1 <- xy[sample(1:dim(xy)[1],50,replace=FALSE),]
plot(xy.sample1, pch = 19, col = 'black', add = TRUE)


set.seed(15892)
xy.sample2 <- discrete.inhibit.sample(obj=xy,size = 100,
                                      delta = 0.08,plotit = TRUE)
plot(st_geometry(xy),pch=19, cex = 0.25, col="black", add = TRUE)


# Generate spatially inhibitory sample
# with close pairs (cp.zeta criterion):
set.seed(15892)
xy.sample3 <- discrete.inhibit.sample(obj=xy, size = 100,delta = 0.065,
                                     k = 25,cp.criterion = "cp.zeta",
                                     zeta = 0.025, plotit = TRUE)
plot(st_geometry(xy),pch=19, cex = 0.25, col="black", add = TRUE)


# Generate spatially inhibitory sample
# with close pairs (cp.neighb criterion):
set.seed(15892)
xy.sample4 <- discrete.inhibit.sample(obj=xy,size = 100,
                                      delta = 0.065, k = 25,cp.criterion = "cp.neighb",
                                      plotit = TRUE)
plot(st_geometry(xy),pch=19, cex = 0.25, col="black", add = TRUE)


# Generate spatially inhibitory sample
# with close pairs (cp.zeta criterion):
set.seed(15892)
xy.sample5 <- discrete.inhibit.sample(obj=xy,size = 100,
                                      delta = 0.065, cp.criterion = "cp.zeta",
                                      zeta = 0.025, delta.fix = TRUE,
                                      k = 25, plotit = TRUE)
plot(st_geometry(xy),pch=19, cex = 0.25, col="black", add = TRUE)


# Generate simple inhibitory sample from a regular grid
library("PrevMap")
data("sim.data")
set.seed(15892)
xy.sample6 <- discrete.inhibit.sample(obj = sim.data,
                                      size = 50, delta = 0.08,plotit = TRUE)
plot(st_geometry(sim.data),pch=19,col="black", cex = 0.25, add = TRUE)


# Generate inhibitory plus close pairs sample from a regular grid
set.seed(15892)
xy.sample7 <- discrete.inhibit.sample(obj = sim.data,
                                      cp.criterion = "cp.neighb", size = 50,
                                      delta = 0.1, k = 5, plotit =TRUE)
plot(st_geometry(sim.data),pch=19,col="black", cex = 0.25, add = TRUE)

geosample documentation built on May 2, 2019, 6:15 a.m.