From 39a487f26a4bdec31ab09b3e62eee9810b5d8daa Mon Sep 17 00:00:00 2001
From: Polina Lakrisenko
Date: Wed, 4 Feb 2026 21:07:43 +0100
Subject: [PATCH 1/2] fix mean of residuals in plot_goodness_of_fit
---
petab/v1/visualize/plot_residuals.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/petab/v1/visualize/plot_residuals.py b/petab/v1/visualize/plot_residuals.py
index 46e83fb9..a15a46b3 100644
--- a/petab/v1/visualize/plot_residuals.py
+++ b/petab/v1/visualize/plot_residuals.py
@@ -199,7 +199,8 @@ def plot_goodness_of_fit(
ax.plot(x, x, linestyle="--", color="gray")
ax.plot(x, intercept + slope * x, "r", label="fitted line")
- mse = np.mean(np.abs(residual_df["residual"]))
+ # assumes that residuals are normalized by default
+ msnr = np.mean(np.power(residual_df["residual"], 2))
ax.text(
0.1,
0.70,
@@ -207,7 +208,7 @@ def plot_goodness_of_fit(
f"slope: {slope:.2f}\n"
f"intercept: {intercept:.2f}\n"
f"p-value: {p_value:.2e}\n"
- f"mean squared error: {mse:.2e}\n",
+ f"mean of squared normalized residuals: {msnr:.2e}\n",
transform=ax.transAxes,
)
From 7757a1dc1c633d7bf209952eb1ada8eb714a7297 Mon Sep 17 00:00:00 2001
From: Polina Lakrisenko
Date: Wed, 4 Feb 2026 21:19:23 +0100
Subject: [PATCH 2/2] add line break
---
petab/v1/visualize/plot_residuals.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/petab/v1/visualize/plot_residuals.py b/petab/v1/visualize/plot_residuals.py
index a15a46b3..63c21ddd 100644
--- a/petab/v1/visualize/plot_residuals.py
+++ b/petab/v1/visualize/plot_residuals.py
@@ -208,7 +208,7 @@ def plot_goodness_of_fit(
f"slope: {slope:.2f}\n"
f"intercept: {intercept:.2f}\n"
f"p-value: {p_value:.2e}\n"
- f"mean of squared normalized residuals: {msnr:.2e}\n",
+ f"mean of squared\nnormalized residuals: {msnr:.2e}\n",
transform=ax.transAxes,
)