nispace.stats.misc.step_maxT_correction

nispace.stats.misc.step_maxT_correction(obs_stats, null_colocs, stat, tail='two', how='r', alpha=0.05, dtype=None)[source]

Step-down Max-T FWER correction ([31]).

Enforces monotonicity on sorted max-T p-values for increased power over plain maxT.

Plain numpy/pandas (no numba). Companion to maxT_correction() (same signature); used in api.py as the mc_method=”stepdownmaxT” option, dispatched alongside maxT_correction based on mc_method.

Parameters:
  • obs_stats (DataFrame or array, shape (n_Y, n_X)) – Observed test statistics.

  • null_colocs (list[n_perm] of {stat: (n_Y, n_X) array}) – Per-permutation null statistic dicts, as produced by the permutation machinery in core/permute.py.

  • stat (str) – Key to extract from each null_colocs dict.

  • tail ({"two", "upper", "lower"}, default="two") – Sidedness of the comparison.

  • how ({"r", "a"}, default="r") – “r”: step-down max computed per-Y row, across X. “a”: step-down max computed globally across the flattened Y×X array.

  • alpha (float, default=0.05) – Significance threshold for the reject output.

  • dtype (optional) – Cast the DataFrame/Series outputs to this dtype.

Returns:

p, reject – Step-down max-T p-values (clipped to [0, 1]) and boolean rejection mask.

Return type:

same type as obs_stats

Raises:

ValueError – If how is not “r” or “a”.