spiketools.stats.permutations.compute_surrogate_pvalue

spiketools.stats.permutations.compute_surrogate_pvalue(value, surrogates)[source]

Compute the empirical p-value from a distribution of surrogates.

Parameters:
valuefloat

Test value.

surrogates1d array

Distribution of surrogates.

Returns:
float

The empirical p-value.

Examples

Compute empirical p-value for a computed value compared to a distribution of surrogates:

>>> value = 0.9
>>> surrogates = np.random.normal(size=100)
>>> pval = compute_surrogate_pvalue(value, surrogates)