
Product Within Distance (Spatially Balanced Sampling Design)
pwd.Rd
Selects spatially balanced samples through the use of the
Product Within Distance design (PWD). To have constant inclusion
probabilities \(\pi_{i}=n/N\), where \(n\) is sample size and
\(N\) is population size, the distance matrix has to be standardized with
function stprod
.
Arguments
- dis
A distance matrix NxN that specifies how far all the pairs of units in the population are.
- n
Sample size.
- beta
Parameter \(\beta\) for the algorithm. The higher \(\beta\) is, the more the sample is going to be spread (default = 10).
- nrepl
Number of samples to draw (default = 1).
- niter
Maximum number of iterations for the algorithm. More iterations are better but require more time. Usually 10 is very efficient (default = 10).
Value
Returns a list with the following components:
s
, a matrixnrepl
xn
, which contains thenrepl
selected samples, each of them stored in a row. In particular, the i-th row contains all labels of units selected in the i-th sample.iterations
, number of iterations run by the algorithm.
References
Benedetti R, Piersimoni F (2017). A spatially balanced design with probability function proportional to the within sample distance. Biometrical Journal, 59(5), 1067-1084. doi:10.1002/bimj.201600194
Examples
# Example 1
# Draw 1 sample of dimension 15 without constant inclusion probabilities
dis <- as.matrix(dist(cbind(lucas_abruzzo$x, lucas_abruzzo$y))) # distance matrix
s <- pwd(dis = dis, n = 15)$s # drawn sample
# \donttest{
# Example 2
# Draw 1 sample of dimension 15 with constant inclusion probabilities
# equal to n/N, with N = population size
dis <- as.matrix(dist(cbind(lucas_abruzzo$x, lucas_abruzzo$y))) # distance matrix
con <- rep(0, nrow(dis)) # vector of constraints
stand_dist <- stprod(mat = dis, con = con) # standardized matrix
s <- pwd(dis = stand_dist$mat, n = 15)$s # drawn sample
# Example 3
# Draw 2 samples of dimension 15 with constant inclusion probabilities
# equal to n/N, with N = population size, and an increased level of spread, beta = 20
dis <- as.matrix(dist(cbind(lucas_abruzzo$x, lucas_abruzzo$y))) # distance matrix
con <- rep(0, nrow(dis)) # vector of constraints
stand_dist <- stprod(mat = dis, con = con) # standardized matrix
s <- pwd(dis = stand_dist$mat, n = 15, beta = 20, nrepl = 2)$s # drawn samples
# }