import numpy as np
import pysps
= np.arange(10)
x = pysps.InclusionProb(x, 6) pi
PoissonSample
=None) PoissonSample(pi, prn
Ordinary Poisson sampling.
Parameters
pi : InclusionProb
-
Inclusion probabilities for units in the population.
prn : ArrayLike = None
-
Permanent random numbers. Should be a flat array of values, the same length as
pi
, distributed uniform between 0 and 1. The default draws a sample without permanent random numbers.
Attributes
units : Array
-
Indices for units in the sample.
weights : Array
-
Design weights for units in the sample.
take_all : Array
-
Take-all units in the sample.
take_some : Array
-
Take-some units in the sample.
prn : Array
-
Random numbers used for drawing the sample.
References
Ohlsson, E. (1998). Sequential Poisson Sampling. Journal of Official Statistics, 14(2): 149-162.
Examples
# Draw an ordinary Poisson sample using permanent random numbers.
= np.random.default_rng(54321).uniform(size=10)
prn = pysps.PoissonSample(pi, prn)
sample sample.units
array([3, 4, 5, 6, 7, 8, 9])