HSEL.bigz: Sample without replacement when the population can be huge.

Description Usage Arguments Details Value Note References See Also Examples

Description

General a small sample of size M out of a huge population of size N.

Usage

1
2
3
HSEL.bigz(N, M, seed=0)
rejsample(N, M, seed=0)
sample1(N, seed=0)

Arguments

N

The size of the population.

M

The sample size.

seed

A bigz integer of random number seed. See urand.bigz.

Details

HSEL.bigz generates a sample of size M from a population of size N, with space complexity linear in M. rejsample is similar to HSEL.bigz, but implemented using direct rejection through unique. sample1 generates one number of 0 to N-1 using simple rejection and urand.bigz.

Value

For HSEL.bigz and rejsample, a bigz vector of length N, between 1 and N. For sample1, a bigz integer, between 0 and N-1.

Note

rejsample can be very slow when M is large.

References

Jarmo Ernvall and Olli Nevalainen. 1982. An Algorithm for Unbiased Random Sampling. THE COMPUTER JOURNAL, VOL. 25, NO. 1, 45–47

See Also

sample, urand.bigz

Examples

1
2
3
HSEL.bigz(factorialZ(15),5,12345)
rejsample(factorialZ(15),5,12345)
sample1(factorialZ(15), 12345)

MRPP documentation built on May 2, 2019, 4:46 p.m.