MonteCarloMethod#
- class scipy.stats.MonteCarloMethod(n_resamples=9999, batch=None, rvs=None)[source]#
Configuration information for a Monte Carlo hypothesis test.
Instances of this class can be passed into the method parameter of some hypothesis test functions to perform a Monte Carlo version of the hypothesis tests.
- Attributes:
- n_resamplesint, optional
The number of Monte Carlo samples to draw. Default is 9999.
- batchint, optional
The number of Monte Carlo samples to process in each vectorized call to the statistic. Batch sizes >>1 tend to be faster when the statistic is vectorized, but memory usage scales linearly with the batch size. Default is
None
, which processes all samples in a single batch.- rvscallable or tuple of callables, optional
A callable or sequence of callables that generates random variates under the null hypothesis. Each element of
rvs
must be a callable that accepts keyword argumentsize
(e.g.rvs(size=(m, n))
) and returns an N-d array sample of that shape. Ifrvs
is a sequence, the number of callables inrvs
must match the number of samples passed to the hypothesis test in which theMonteCarloMethod
is used. Default isNone
, in which case the hypothesis test function chooses values to match the standard version of the hypothesis test. For example, the null hypothesis ofscipy.stats.pearsonr
is typically that the samples are drawn from the standard normal distribution, sorvs = (rng.normal, rng.normal)
whererng = np.random.default_rng()
.