Draws a sample with unequal selection probabilities, with replacement or minimum replacement.
Usage
unequal_prob_wr(
hits,
method = c("chromy", "multinomial"),
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)must be close to a positive integer.- method
The sampling method:
"chromy"Chromy's (1979) sequential PPS with minimum replacement. Default method in SAS SURVEYSELECT. 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).
- nrep
Number of replicate samples (default 1).
- prn
Optional vector of permanent random numbers for sample coordination. Not currently used by any WR method; a warning is issued if provided.
- ...
Additional arguments passed to methods.
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. Memorial JSM.
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(42)
s <- unequal_prob_wr(hits, method = "chromy")
s$sample
#> [1] 1 2 4
s$hits
#> [1] 1 1 0 1 0