PermutationMethod#
- class scipy.stats.PermutationMethod(n_resamples=9999, batch=None, random_state=None, *, rng=None)[source]#
Configuration information for a permutation hypothesis test.
Instances of this class can be passed into the method parameter of some hypothesis test functions to perform a permutation version of the hypothesis tests.
- Attributes:
- n_resamplesint, optional
The number of resamples to perform. Default is 9999.
- batchint, optional
The number of resamples 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 resamples in a single batch.- rng
numpy.random.Generator, optional Pseudorandom number generator used to perform resampling.
If
rngis passed by keyword to the initializer or therngattribute is used directly, types other thannumpy.random.Generatorare passed tonumpy.random.default_rngto instantiate aGeneratorbefore use. Ifrngis already aGeneratorinstance, then the provided instance is used. Specifyrngfor repeatable behavior.If this argument is passed by position, if
random_stateis passed by keyword into the initializer, or if therandom_stateattribute is used directly, legacy behavior forrandom_stateapplies:If
random_stateis None (ornumpy.random), thenumpy.random.RandomStatesingleton is used.If
random_stateis an int, a newRandomStateinstance is used, seeded withrandom_state.If
random_stateis already aGeneratororRandomStateinstance then that instance is used.
Changed in version 1.15.0: As part of the SPEC-007 transition from use of
numpy.random.RandomStatetonumpy.random.Generator, this attribute name was changed fromrandom_statetorng. For an interim period, both names will continue to work, although only one may be specified at a time. After the interim period, uses ofrandom_statewill emit warnings. The behavior of bothrandom_stateandrngare outlined above, but onlyrngshould be used in new code.