nimare.stats.nullhist_to_p

nullhist_to_p(test_values, histogram_weights, histogram_bins)[source]

Return one-sided p-value for test value against null histogram.

Added in version 0.0.4.

Parameters:
  • test_values (float or 1D array_like) – Values for which to determine p-value. Can be a single value or a one-dimensional array. If a one-dimensional array, it should have the same length as the histogram_weights’ last dimension.

  • histogram_weights ((B [x V]) array) – Histogram weights representing the null distribution against which test_value is compared. These should be raw weights or counts, not a cumulatively-summed null distribution.

  • histogram_bins – Histogram bin centers. Note that this differs from numpy.histogram’s behavior, which uses bin edges. Histogram bins created with numpy will need to be adjusted accordingly.

Returns:

p_value – P-value associated with the test value when compared against the null distribution. P-values reflect the probability of a test value at or above the observed value if the test value was drawn from the null distribution. This is a one-sided p-value.

Return type:

float

Notes

P-values are clipped based on the largest observed non-zero weight in the null histogram. Therefore no p-values of 0 should be produced.