qrvs — SciPy v1.15.3 Manual (original) (raw)
scipy.stats.sampling.NumericalInverseHermite.
NumericalInverseHermite.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 isNone
, d is determined from the dimension of the qmc_engine. - If qmc_engine is not
None
and d is notNone
but the dimensions are inconsistent, aValueError
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 isNone
,tuple_shape = (size,)
if size is anint
,tuple_shape = size
if size is a sequence,d_shape = tuple()
if d isNone
or d is 1, andd_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.