scipy.stats.sampling.NumericalInversePolynomial.qrvs#

NumericalInversePolynomial.qrvs(size=None, d=None, qmc_engine=None)#

Quasi-random variates of the given RV.

The qmc_engine is used to draw uniform quasi-random variates, and these are converted to quasi-random variates of the given RV using inverse transform sampling.

Parameters:
sizeint, tuple of ints, or None; optional

Defines shape of random variates array. Default is None.

dint or None, optional

Defines dimension of uniform quasi-random variates to be transformed. Default is None.

qmc_enginescipy.stats.qmc.QMCEngine(d=1), optional

Defines the object to use for drawing quasi-random variates. Default is None, which uses scipy.stats.qmc.Halton(1).

Returns:
rvsndarray or scalar

Quasi-random variates. See Notes for shape information.

Notes

The shape of the output array depends on size, d, and qmc_engine. The intent is for the interface to be natural, but the detailed rules to achieve this are complicated.

  • If qmc_engine is None, a scipy.stats.qmc.Halton instance is created with dimension d. If d is not provided, d=1.

  • If qmc_engine is not None and d is None, d is determined from the dimension of the qmc_engine.

  • If qmc_engine is not None and d is not None but the dimensions are inconsistent, a ValueError is raised.

  • After d is determined according to the rules above, the output shape is tuple_shape + d_shape, where:

    • tuple_shape = tuple() if size is None,

    • tuple_shape = (size,) if size is an int,

    • tuple_shape = size if size is a sequence,

    • d_shape = tuple() if d is None or d is 1, and

    • d_shape = (d,) if d is greater than 1.

The elements of the returned array are part of a low-discrepancy sequence. If d is 1, this means that none of the samples are truly independent. If d > 1, each slice rvs[..., i] will be of a quasi-independent sequence; see scipy.stats.qmc.QMCEngine for details. Note that when d > 1, the samples returned are still those of the provided univariate distribution, not a multivariate generalization of that distribution.