MonteCarloMethod#
- class scipy.stats.MonteCarloMethod(n_resamples=9999, batch=None, rvs=None, rng=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 - rvsmust be a callable that accepts keyword argument- size(e.g.- rvs(size=(m, n))) and returns an N-d array sample of that shape. If- rvsis a sequence, the number of callables in- rvsmust match the number of samples passed to the hypothesis test in which the- MonteCarloMethodis used. Default is- None, in which case the hypothesis test function chooses values to match the standard version of the hypothesis test. For example, the null hypothesis of- scipy.stats.pearsonris typically that the samples are drawn from the standard normal distribution, so- rvs = (rng.normal, rng.normal)where- rng = np.random.default_rng().
- rngnumpy.random.Generator, optional
- Pseudorandom number generator state. When - rngis None, a new- numpy.random.Generatoris created using entropy from the operating system. Types other than- numpy.random.Generatorare passed to- numpy.random.default_rngto instantiate a- Generator.