import numpy as np
import pysps
= [1, 2, 3, 4, 5]
x = pysps.InclusionProb(x, 3)
pi pi
InclusionProb(array([0.2, 0.4, 0.6, 0.8, 1. ]), 3)
First-order inclusion probabilities for units in the population.
x : ArrayLike
Sizes for units in the population. Should be a flat array of positive numbers.
n : int
Sample size.
alpha : float = 0.001
A number between 0 and 1 such that units with inclusion probabilities greater than or equal to 1 - alpha are set to 1. The default is slightly larger than 0. See Ohlsson (1998) for details.
cutoff : float = np.inf
A number such that all units with size greater than or equal to cutoff get an inclusion probability of 1. The default does not apply a cutoff.
sort_method : (stable, partial) = 'stable'
Sorting method to use when allocation take-all units. The default uses a stable sort. Using a partial sort can be faster if there are no duplicate in x
.
values : Array
Vector of inclusion probabilties.
n : int
Sample size.
take_all : Array
Take-all units.
take_some : Array
Take-some units.
Ohlsson, E. (1998). Sequential Poisson Sampling. Journal of Official Statistics, 14(2): 149-162.
Tillé, Y. (2006). Sampling Algorithms. Springer.
InclusionProb(array([0.2, 0.4, 0.6, 0.8, 1. ]), 3)