Returns each unit's probability of being sampled under simple random sampling. Every unit is sampled independently, so the probabilities do not depend on which other units were drawn.
simple_rs_probabilities(
N,
prob = NULL,
prob_unit = NULL,
check_inputs = TRUE,
simple = TRUE
)A numeric vector of length N giving each unit's probability of being included in the sample.
The number of units in the sampling frame. Must be a positive integer. (required)
The probability of being sampled; must be a real number between 0 and 1 inclusive and of length 1. (optional)
The probability of being sampled for each unit; must be a real number between 0 and 1 inclusive and of length N. Because units are drawn independently, this probability may differ from unit to unit. (optional)
Logical. Whether to verify before sampling that the arguments are internally consistent: that probabilities lie between 0 and 1, that vectors are of length N, and that only one of prob and prob_unit is supplied. Defaults to TRUE. Set to FALSE to skip the checks when drawing many samples from arguments that have already been verified; declaring the design once with declare_rs() and drawing from it with draw_rs() does this for you. (optional)
Logical. Internal use only; leave at its default. simple_rs always draws units independently, and this argument exists so that the argument checker knows as much. (optional)
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.
simple_rs()
probs <- simple_rs_probabilities(N = 100)
table(probs)
probs <- simple_rs_probabilities(N = 100, prob = 0.3)
table(probs)
Run the code above in your browser using DataLab