osm_contin_inhibit_sample: OSM Continuous Inhibitory sampling.

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

View source: R/osm_cont_inhibit.R

Description

Draws a spatially continous sample of locations within a polygonal sampling region according to an 'inhibitory plus close pairs' specification. The region can be defined using OSM data or a user defined polygon.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
osm_contin_inhibit_sample(
  bounding_geom = NULL,
  boundary = 0,
  buff_dist = 0,
  buff_epsg = 4326,
  sample_size,
  plotit = TRUE,
  plotit_leaflet = TRUE,
  delta,
  delta.fix = FALSE,
  k = 0,
  rho = NULL,
  ntries = 10000
)

Arguments

bounding_geom

a sf or sp object (with N ≥q \code{size}) where each line corresponds to one spatial location. It should contain values of 2D coordinates, data and, optionally, covariate(s) value(s) at the locations. This argument must be provided when sampling from a 'discrete' set of points, see 'type' below for details.

boundary

categorical variable to determine whether the exact boundary provided (boundary = 0), the bounding box (boundary = 1) or a buffer around the boundary (boundary = 2) is used for sampling. Default is boundary = 0.

buff_dist

if boundary = 2 then this value determines the size of the buffer by distance. The default is buff_dist is NULL).

buff_epsg

if boundary = 2 then this value determines the local geographic grid reference so that the buffer can be calculated in meters. The default is buff_epsg = 4326 which will use decimal degrees instead of meters. As an example, 27700 relates to the British National Grid.

sample_size

a non-negative integer giving the total number of locations to be sampled.

plotit

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

plotit_leaflet

'logical' specifying if leaflet (html) graphical output is required. This is prioritised over plotit if both are selected. Default is plotit_leaflet = TRUE.

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.

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.

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.

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.

Value

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.

Note

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

Author(s)

Henry J. Crosby henry.crosby@warwick.ac.uk

Godwin Yeboah godwin.yeboah@warwick.ac.uk

J. Porto De Albuquerque J.Porto@warwick.ac.uk

References

Rowlingson, B. and Diggle, P. 1993 Splancs: spatial point pattern analysis code in S-Plus. Computers and Geosciences, 19, 627-655 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. https://wiki.openstreetmap.org/wiki/Map_Features

See Also

osm_random_sample and osm_discrete_inhibit_sample

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
## Not run: 
library(sp)
bounding_geom<-
SpatialPolygonsDataFrame(
   SpatialPolygons(list(Polygons(list(Polygon(
       cbind(
           c(3.888959,3.888744,3.888585,3.888355,3.887893,3.887504,
           3.886955,3.886565,3.886303,3.886159,3.885650,3.885650,
           3.885595,3.885404,3.885444,3.885897,3.886692,3.887241,
           3.888068,3.888323,3.888697,3.889150,3.889548,3.889890,
           3.890184,3.890828,3.891258,3.891807,3.892061,3.892292,
           3.892689,3.893294,3.893008,3.893676,3.888959),
           c(7.379483,7.379785,7.380024,7.380294,7.380629,7.380986,
           7.381448,7.381861,7.382243,7.382474,7.383277,7.383468,
           7.383890,7.384263,7.384669,7.385258,7.385313,7.385194,
           7.384868,7.384900,7.385051,7.385067,7.384955,7.384749,
           7.384526,7.384120,7.384009,7.384080,7.384430,7.384478,
           7.384629,7.384772,7.383269,7.380963,7.379483)))), ID=1))),
   data.frame( ID=1))
proj4string(bounding_geom) <- CRS('+proj=longlat +datum=WGS84')

set.seed(15892)
osm_contin_inhibit_sample(bounding_geom = bounding_geom, boundary = 0,
buff_dist=NULL,
buff_epsg = NULL, sample_size = 50, plotit = TRUE, plotit_leaflet = TRUE,
                  delta=50, delta.fix = FALSE,k=7,rho=1, ntries = 10)

## End(Not run)

osmgeosample documentation built on Feb. 7, 2021, 5:05 p.m.