discrete.sample {PrevMap} | R Documentation |
Spatially discrete sampling
Description
Draws a sub-sample from a set of units spatially located irregularly over some defined geographical region by imposing a minimum distance between any two sampled units.
Usage
discrete.sample(xy.all, n, delta, k = 0)
Arguments
xy.all |
set of locations from which the sample will be drawn. |
n |
size of required sample. |
delta |
minimum distance between any two locations in preliminary sample. |
k |
number of locations in preliminary sample to be replaced by nearest neighbours of other preliminary sample locations in final sample (must be between 0 and |
Details
To draw a sample of size n
from a population of spatial locations , with the property that the distance between any two sampled locations is at least
delta
, the function implements the following algorithm.
Step 1. Draw an initial sample of size
n
completely at random and call this.
Step 2. Set
and calculate the minimum,
, of the distances from
to all other
in the initial sample.
Step 3. If
, increase
by 1 and return to step 2 if
, otherwise stop.
Step 4. If
, draw an integer
at random from
, set
and return to step 3.
Samples generated in this way will exhibit a more regular spatial arrangement than would a random sample of the same size. The degree of regularity achievable will be influenced by the spatial arrangement of the population , the specified value of
delta
and the sample size n
. For any given population, if n
and/or delta
are too large, a sample of the required size with the distance between any two sampled locations at least delta
will not be achievable; the suggested solution is then to run the algorithm with a smaller value of delta
.
Sampling close pairs of points.
For some purposes, it is desirable that a spatial sampling scheme include pairs of closely spaced points. In this case, the above algorithm requires the following additional steps to be taken.
Let k
be the required number of close pairs.
Step 5. Set
and draw a random sample of size 2 from the integers
, say
.
Step 6. Find the integer
such that the distances from
to
is the minimum of all
distances from
to the
.
Step 7. Replace
by
, increase
by 1 and return to step 5 if
, otherwise stop.
Value
A matrix of dimension n
by 2 containing the final sampled locations.
Author(s)
Emanuele Giorgi e.giorgi@lancaster.ac.uk
Peter J. Diggle p.diggle@lancaster.ac.uk
Examples
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)
par(pty="s",mfrow=c(1,2))
plot(xy[,1],xy[,2],pch=19,cex=0.25,xlab="Easting",ylab="Northing",
cex.lab=1,cex.axis=1,cex.main=1)
set.seed(15892)
# Generate spatially random sample
xy.sample<-xy[sample(1:dim(xy)[1],50,replace=FALSE),]
points(xy.sample[,1],xy.sample[,2],pch=19,col="red")
points(xy[,1],xy[,2],pch=19,cex=0.25)
plot(xy[,1],xy[,2],pch=19,cex=0.25,xlab="Easting",ylab="Northing",
cex.lab=1,cex.axis=1,cex.main=1)
set.seed(15892)
# Generate spatially regular sample
xy.sample<-discrete.sample(xy,50,0.08)
points(xy.sample[,1],xy.sample[,2],pch=19,col="red")
points(xy[,1],xy[,2],pch=19,cex=0.25)