nimare.transforms.chi2_to_nlogp

chi2_to_nlogp(chi2_values, dof)[source]

Convert chi-squared statistics to nlogp, the natural logarithm of the p-value.

Added in version 0.21.0.

The upper tail, which is the only one a chi-squared test uses.

Parameters:
  • chi2_values (array_like) – Chi-squared statistics.

  • dof (int) – Degrees of freedom.

Returns:

nlogp – Natural logarithms of the p-values, as z_to_nlogp() returns them.

Return type:

array_like

Notes

One degree of freedom, the common case here, is evaluated through _log_erfc(). The general case defers to pymare.stats.log_chi2_sf(), which is equally accurate but reaches the non-underflowing majority of values through scipy.stats.rv_continuous.logsf() and so costs about a microsecond each – two orders of magnitude more, which voxelwise use cannot afford.