pearson_bin_residuals

simsit.uncertainty_metrics.pearson_bin_residuals(values, ndof, nbin)

Compute binned Pearson residuals for goodness-of-fit to a chi-squared distribution.

The sample is binned using equiprobable bins under the reference chi-squared distribution. For each bin, this returns

(observed - expected) / sqrt(expected)

Parameters

valuesarray-like

Sample of chi-squared values to test.

ndofint

Degrees of freedom of the reference chi-squared distribution.

nbinint

Number of equiprobable bins.

Returns

ndarray

Pearson residuals for each bin.

Notes

These residuals are useful for diagnosing where the sample differs from the reference distribution, for example in the tails or near the center.