import numpy as np
import pysps
x = np.arange(10)
pi = pysps.InclusionProb(x, 6)PoissonSample
PoissonSample(pi, prn=None)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.
prn = np.random.default_rng(54321).uniform(size=10)
sample = pysps.PoissonSample(pi, prn)
sample.unitsarray([3, 4, 5, 6, 7, 8, 9])