{ } Raw JSON

bundles / scipy 1.17.1 / scipy / stats / _mgc / _perm_test

function

scipy.stats._mgc:_perm_test

source: /scipy/stats/_mgc.py :36

Signature

def   _perm_test ( x y stat reps = 1000 workers = -1 random_state = None )

Summary

Helper function that calculates the p-value. See below for uses.

Parameters

x, y : ndarray

x and y have shapes (n, p) and (n, q).

stat : float

The sample test statistic.

reps : int, optional

The number of replications used to estimate the null when using the permutation test. The default is 1000 replications.

workers : int or map-like callable, optional

If workers is an int the population is subdivided into workers sections and evaluated in parallel (uses multiprocessing.Pool <multiprocessing>). Supply -1 to use all cores available to the Process. Alternatively supply a map-like callable, such as multiprocessing.Pool.map for evaluating the population in parallel. This evaluation is carried out as workers(func, iterable). Requires that func be pickleable.

random_state : {None, int, `numpy.random.Generator`,

numpy.random.RandomState}, optional

If seed is None (or np.random), the numpy.random.RandomState singleton is used. If seed is an int, a new RandomState instance is used, seeded with seed. If seed is already a Generator or RandomState instance then that instance is used.

Returns

pvalue : float

The sample test p-value.

null_dist : list

The approximated null distribution.

Aliases

  • scipy.stats._mgc._perm_test