Inclusion probabilities: Complete Random Sampling
Source:R/complete_rs.R
complete_rs_probabilities.RdReturns each unit's probability of being sampled under complete random sampling, where the sample size is fixed on every draw.
Usage
complete_rs_probabilities(
N,
n = NULL,
n_unit = NULL,
prob = NULL,
prob_unit = NULL,
check_inputs = TRUE
)Arguments
- N
The number of units in the sampling frame. Must be a positive integer. (required)
- n
Use for a design in which exactly
nunits are sampled. (optional)- n_unit
unique(n_unit)will be passed ton; must be the same for all units and of length N. (optional)- prob
Use for a design in which either
floor(N*prob)orceiling(N*prob)units are sampled, chosen so that each unit's probability of inclusion is exactlyprob. Must be a real number between 0 and 1 inclusive. (optional)- prob_unit
unique(prob_unit)will be passed toprob; must be the same for all units and of length N. Under complete random sampling the probability cannot vary by unit; usesimple_rs()if it must. (optional)- check_inputs
Logical. Whether to verify before sampling that the arguments are internally consistent: that
ndoes not exceed N, that probabilities lie between 0 and 1, that vectors are of length N, and so on. Defaults toTRUE. Set toFALSEto skip the checks when drawing many samples from arguments that have already been verified; declaring the design once withdeclare_rs()and drawing from it withdraw_rs()does this for you. (optional)
Details
These are the quantities inverse-probability weights are built from: weight
each sampled unit by the reciprocal of its inclusion probability, which
obtain_inclusion_probabilities() extracts for you.