pypomp.random.binominv¶
- pypomp.random.binominv(u: Array, n: Array, p: Array, exact_max: int = 5, order: int = 2, dtype: dtype | None = None) Array[source]¶
Compute the approximate inverse binomial CDF using JAX primitives.
Vectorised implementation using the normal asymptotic expansion formulas from Giles and Beentjes (2024) [1]. A bottom-up exact inverse CDF calculation is performed for small values.
- Parameters:
u (jax.Array) – Uniform probabilities in
[0, 1]. Scalar or array.n (jax.Array) – Number of trials. Must be a positive integer or float.
p (jax.Array) – Success probability in
[0, 1].exact_max (int, optional) – Maximum iterations for the bottom-up exact inverse CDF stage. Defaults to
5.order (int, optional) – Order of approximation (0, 1, or 2). Defaults to
2.dtype (np.dtype or None, optional) – Floating-point dtype for computation. Inferred from inputs if
None.
- Returns:
Array of binomial quantiles with the broadcast shape of the inputs.
- Return type:
Notes
For speed and accuracy metrics, see the Quant Tests.
See also
fast_binomialHigh-level sampler that wraps this function.
References