From f682ad463fcc7ff8f7a6bbf9d5ed44e134a3de33 Mon Sep 17 00:00:00 2001 From: PiaLJP Date: Mon, 20 Oct 2025 17:34:41 +0200 Subject: [PATCH] [Fix] corrected expected_chisquare by adding the number of priors --- pyerrors/fits.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyerrors/fits.py b/pyerrors/fits.py index 3a3119b3..62714330 100644 --- a/pyerrors/fits.py +++ b/pyerrors/fits.py @@ -472,7 +472,7 @@ def least_squares(x, y, func, priors=None, silent=False, **kwargs): hat_vector = prepare_hat_matrix() A = W @ hat_vector P_phi = A @ np.linalg.pinv(A.T @ A) @ A.T - expected_chisquare = np.trace((np.identity(y_all.shape[-1]) - P_phi) @ W @ cov @ W) + expected_chisquare = np.trace((np.identity(y_all.shape[-1]) - P_phi) @ W @ cov @ W) + len(loc_priors) output.chisquare_by_expected_chisquare = output.chisquare / expected_chisquare if not silent: print('chisquare/expected_chisquare:', output.chisquare_by_expected_chisquare)