mne_denoise.viz.plot_null_distribution#

mne_denoise.viz.plot_null_distribution(null_values, observed, metric_label='Statistic', ci=95, n_bins=60, suptitle=None, series_color=None, figsize=None, fname=None, show=True)[source]#

Plot a null-distribution histogram with observed statistic and CI.

Parameters:
  • null_values (array-like) – Samples from the null distribution.

  • observed (float) – Observed statistic to compare against the null.

  • metric_label (str) – Label for the x-axis.

  • ci (float) – Central interval width in percent.

  • n_bins (int) – Number of histogram bins.

  • suptitle (str | None) – Figure title override.

  • series_color (str | None) – Color for the observed-statistic marker/annotation.

  • figsize (tuple | None) – Figure size in inches.

  • fname (path-like | None) – Optional output path.

  • show (bool) – Whether to display the figure.

Returns:

  • fig (matplotlib.figure.Figure) – Figure handle.

  • p_value (float) – Two-sided empirical p-value under null_values.

Examples

>>> import numpy as np
>>> from mne_denoise.viz import plot_null_distribution
>>> rng = np.random.default_rng(0)
>>> null = rng.normal(0.0, 0.1, 1000)
>>> fig, p = plot_null_distribution(null, observed=0.25, show=False)