nispace.stats.misc.null_to_p

nispace.stats.misc.null_to_p(test_value, null_array, tail='two', fit_norm=False)[source]

Return p-value for test value(s) against null array.

Adopted from NiMARE v0.0.12: https://zenodo.org/record/6600700 (NiMARE/nimare/stats.py)

Parameters:
  • test_value (1D array_like) – Values for which to determine p-value.

  • null_array (1D array_like) – Null distribution against which test_value is compared.

  • tail ({'two', 'upper', 'lower'}, optional) – Whether to compare value against null distribution in a two-sided (‘two’) or one-sided (‘upper’ or ‘lower’) manner. If ‘upper’, then higher values for the test_value are more significant. If ‘lower’, then lower values for the test_value are more significant. Default is ‘two’.

  • fit_norm (boolean) – Whether to fit a normal distribution to null_array data and compute p values from that. Might be useful if the relative order of multiple highly significant p values is of interest, but the number of null values cannot be increased sufficiently.

Returns:

p_value – P-value(s) associated with the test value when compared against the null distribution. Return type matches input type (i.e., a float if test_value is a single float, and an array if test_value is an array).

Return type:

float

Notes

P-values are clipped based on the number of elements in the null array, if fit_norm=False. In this case, no p-values of 0 or 1 should be produced.