A Wallenius’ noncentral hypergeometric discrete random variable.
Wallenius’ noncentral hypergeometric distribution models drawing objects of
two types from a bin. M is the total number of objects, n is the
number of Type I objects, and odds is the odds ratio: the odds of
selecting a Type I object rather than a Type II object when there is only
one object of each type.
The random variate represents the number of Type I objects drawn if we
draw a pre-determined N objects from a bin one by one.
As an instance of the rv_discrete class, nchypergeom_wallenius object inherits from it
a collection of generic methods (see below for the full list),
and completes them with details specific for this particular distribution.
Methods
rvs(M, n, N, odds, loc=0, size=1, random_state=None)
Random variates.
pmf(k, M, n, N, odds, loc=0)
Probability mass function.
logpmf(k, M, n, N, odds, loc=0)
Log of the probability mass function.
cdf(k, M, n, N, odds, loc=0)
Cumulative distribution function.
logcdf(k, M, n, N, odds, loc=0)
Log of the cumulative distribution function.
sf(k, M, n, N, odds, loc=0)
Survival function (also defined as 1-cdf, but sf is sometimes more accurate).
logsf(k, M, n, N, odds, loc=0)
Log of the survival function.
ppf(q, M, n, N, odds, loc=0)
Percent point function (inverse of cdf — percentiles).
nchypergeom_wallenius uses the BiasedUrn package by Agner Fog with
permission for it to be distributed under SciPy’s license.
The symbols used to denote the shape parameters (N, n, and M) are not
universally accepted; they are chosen for consistency with hypergeom.
Note that Wallenius’ noncentral hypergeometric distribution is distinct
from Fisher’s noncentral hypergeometric distribution, which models
take a handful of objects from the bin at once, finding out afterwards
that N objects were taken.
When the odds ratio is unity, however, both distributions reduce to the
ordinary hypergeometric distribution.
The probability mass function above is defined in the "standardized" form.
To shift distribution use the loc parameter.
Specifically, nchypergeom_wallenius.pmf(k,M,n,N,odds,loc) is identically
equivalent to nchypergeom_wallenius.pmf(k-loc,M,n,N,odds).
Alternatively, the distribution object can be called (as a function)
to fix the shape and location. This returns a "frozen" RV object holding
the given parameters fixed.
Freeze the distribution and display the frozen pmf: