Draws a sample with unequal selection probabilities, with replacement or minimum replacement.
Usage
unequal_prob_wr(
hits,
method = c("chromy", "multinomial", "systematic_mr"),
nrep = 1L,
prn = NULL,
...
)Arguments
- hits
A numeric vector of expected hits (expected number of selections per unit). Typically computed via
expected_hits().sum(hits)is the sample size, so it must be a whole number of at least 1 to floating-point accuracy. Looser sums are rejected rather than silently rounded.- method
The sampling method:
"chromy"Chromy's (1979) sequential PPS with minimum replacement. Pairwise expectations \(E(n_i n_j)\) are estimated by simulation. See
joint_expected_hits(). Complexity: O(N + n)."multinomial"Multinomial PPS (independent draws). Units can be selected any number of times. Pairwise expectations are exact: \(E(n_i n_j) = n(n-1) p_i p_j\). Complexity: O(n).
"systematic_mr"Systematic PPS with minimum replacement (Madow, 1949), the design of
METHOD=PPS_SYSin SAS SURVEYSELECT. One random start walks the cumulated expected hits in the order ofhits, which acts as implicit stratification. Each unit receives the whole part of its expected hits or one more. Unlikeunequal_prob_wor(method = "systematic"), which takes a unit larger than the sampling interval once, with certainty, this method hits it once per interval it spans. When every expected hit is below 1, both draw the same units from the same seed. Pairwise expectations are exact, and some are zero for units that are never selected together. Seesampling_cov(). Complexity: O(N + n), since the sample lists each hit.
- nrep
Number of replicate samples (default 1).
- prn
Optional vector of permanent random numbers for sample coordination. No built-in WR method currently supports
prn; supplying it is an error. Registered methods can opt into PRN support.- ...
Additional arguments passed to methods registered via
register_method(). Built-in methods take no additional arguments.
Value
An object of class c("unequal_prob", "wr", "sondage_sample").
When nrep = 1, $sample is an integer vector and $hits is an
integer vector. When nrep > 1, $sample is a matrix (n x nrep) and
$hits is a matrix (N x nrep).
References
Chromy, J.R. (1979). Sequential sample selection methods. Proceedings of the Survey Research Methods Section, ASA, 401-406.
Chromy, J.R. (2009). Some generalizations of the Horvitz-Thompson estimator. Proceedings of the Survey Research Methods Section, American Statistical Association.
Madow, W.G. (1949). On the theory of systematic sampling, II. Annals of Mathematical Statistics, 20(3), 333-354.
See also
unequal_prob_wor() for without-replacement designs,
expected_hits() to compute expected hits from size measures.
Examples
x <- c(40, 80, 50, 60, 70)
hits <- expected_hits(x, n = 3)
set.seed(12345)
s <- unequal_prob_wr(hits, method = "chromy")
s$sample
#> [1] 2 3 5
s$hits
#> [1] 0 1 1 0 1
# A unit larger than the sampling interval can be hit twice
hits <- expected_hits(c(40, 80, 50, 60, 270), n = 3)
s <- unequal_prob_wr(hits, method = "systematic_mr")
s$hits
#> [1] 0 1 0 1 1