Skip to contents

Draws a simple random sample with replacement.

Usage

equal_prob_wr(N, n, method = "srs", nrep = 1L, prn = NULL, ...)

Arguments

N

Population size (positive integer).

n

Sample size (non-negative integer).

method

The sampling method. Currently only "srs".

nrep

Number of replicate samples (default 1).

prn

Optional vector of permanent random numbers for sample coordination. No equal-probability WR method currently supports prn; supplying it is an error.

...

Reserved for extensions. Built-in methods currently take no additional arguments.

Value

An object of class c("equal_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).

See also

equal_prob_wor() for without-replacement designs, unequal_prob_wr() for unequal probability designs.

Examples

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