Compute inclusion probabilities from a size measure, or extract them from a without-replacement design object.
Usage
inclusion_prob(x, ...)
# S3 method for class 'wor'
inclusion_prob(x, ...)
# S3 method for class 'wr'
inclusion_prob(x, ...)
# Default S3 method
inclusion_prob(x, n, ...)Value
A numeric vector of inclusion probabilities. When applied to a
design object, returns the target inclusion probabilities
(i.e., the pik vector passed to unequal_prob_wor()). For most
methods (cps, brewer, systematic, poisson), these are the
exact first-order inclusion probabilities of the design. For order
sampling methods (sps, pareto), the true first-order inclusion
probabilities are approximately but not exactly equal to the target
for finite populations; the discrepancy vanishes as N grows.
Details
When x is a numeric vector of size measures and n is provided,
computes exact inclusion probabilities via an iterative
algorithm: initial probabilities \(\pi_k = n x_k / \sum x_k\) are
computed, then any unit with \(\pi_k \ge 1\) is set to 1 (certainty
selection) and the remaining probabilities are recomputed with a reduced
\(n\). This process repeats until all probabilities are in \([0, 1]\).
The result always sums to exactly \(n\).
This differs from expected_hits(), which uses simple proportional
allocation \(n x_k / \sum x_k\) without capping – values can exceed 1.
Negative values in x are treated as zero (with a warning).
See also
expected_hits() for the with-replacement analogue,
unequal_prob_wor() for sampling with these probabilities.
Examples
# From size measures
size <- c(10, 20, 30, 40)
pik <- inclusion_prob(size, n = 2)
sum(pik) # 2
#> [1] 2
# From a design object
s <- unequal_prob_wor(pik, method = "cps")
inclusion_prob(s)
#> [1] 0.2 0.4 0.6 0.8
# With certainty selections (large units)
size <- c(1, 1, 1, 100)
pik <- inclusion_prob(size, n = 2)
pik # Unit 4 gets probability 1
#> [1] 0.3333333 0.3333333 0.3333333 1.0000000