spiketools.stats.permutations.compute_surrogate_stats

spiketools.stats.permutations.compute_surrogate_stats(data_value, surrogates, plot=False, verbose=False, **plt_kwargs)[source]

Compute surrogate statistics.

Parameters:
data_valuefloat

Test value.

surrogates1d array

Distribution of surrogates values.

plotbool, optional, default: False

Whether to display the plot of the surrogates values.

verbosebool, optional, default: False

Whether to print the values of the p-value and z-score.

Returns:
p_valfloat

The empirical p-value of the test value, as compared to the surrogates.

z_scorefloat

The z-score of the test value, as compared to the surrogates.

Examples

Compute measures for a computed value compared to a distribution of surrogates:

>>> value = 0.9
>>> surrogates = np.random.normal(size=100)
>>> p_val, z_score = compute_surrogate_stats(value, surrogates)