becomes_ta

becomes_ta(x, *, alpha=0.001, cutoff=np.inf)

Calculate the sample size at which a unit enters the take-all stratum.

Parameters

x : ArrayLike

Sizes for units in the population. Should be a flat array of positive numbers.

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.

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.

Returns

: Array

Sample size at which a unit in the population enters the take-all stratum. A result of nan means that unit is always in the take-all stratum.

Examples

import pysps

x = [0, 1, 2, 3, 4, 5]
pysps.becomes_ta(x)
array([nan,  5.,  5.,  4.,  4.,  3.])