Skip to contents

Draws a sample with equal inclusion probabilities, without replacement.

Usage

equal_prob_wor(
  N,
  n,
  method = c("srs", "systematic", "bernoulli"),
  nrep = 1L,
  prn = NULL,
  ...
)

Arguments

N

Population size (positive integer).

n

Expected sample size. For "srs" and "systematic", must be a non-negative integer not exceeding N. For "bernoulli", this is the expected sample size and p = n/N is used as the selection probability.

method

The sampling method:

"srs"

Simple Random Sampling. Each possible sample of size n has equal probability. Fixed sample size.

"systematic"

Systematic sampling with interval k = N/n. A random start is drawn from (0, k]. Fixed sample size. Implicit stratification based on unit ordering.

"bernoulli"

Bernoulli sampling. Each unit selected independently with probability p = n/N. Random sample size. Note: the realized sample size varies across draws.

nrep

Number of replicate samples (default 1). When nrep > 1, $sample holds a matrix (fixed-size) or list (random-size) of all replicates. The design object and all generics remain usable.

prn

Optional vector of permanent random numbers (length N, values in the open interval (0, 1)) for sample coordination. Only supported by "bernoulli" method. Cannot be used with nrep > 1 (identical PRN would produce identical replicates).

...

Additional arguments passed to methods.

Value

An object of class c("equal_prob", "wor", "sondage_sample"). When nrep = 1, $sample is an integer vector. When nrep > 1, $sample is a matrix (n x nrep) for fixed-size methods, or a list of integer vectors of varying lengths for "bernoulli".

See also

equal_prob_wr() for with-replacement designs, unequal_prob_wor() for unequal probability designs.

Examples

set.seed(1)
s <- equal_prob_wor(10, 3)
s$sample
#> [1] 9 4 7

# Systematic sampling
s <- equal_prob_wor(12, 3, method = "systematic")
s$sample
#> [1]  4  8 12

# Bernoulli sampling (random size, expected n = 30)
s <- equal_prob_wor(100, 30, method = "bernoulli")
length(s$sample)
#> [1] 32