From 857b87236c406d5064c31e67b0b2094000350d4a Mon Sep 17 00:00:00 2001 From: John Bogaardt Date: Mon, 18 Sep 2023 19:04:49 -0600 Subject: [PATCH] addresses #463 --- chainladder/utils/weighted_regression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chainladder/utils/weighted_regression.py b/chainladder/utils/weighted_regression.py index e552889d..2dbfced4 100644 --- a/chainladder/utils/weighted_regression.py +++ b/chainladder/utils/weighted_regression.py @@ -75,7 +75,7 @@ def _fit_OLS_thru_orig(self): fitted_value = fitted_value * x * (y * 0 + 1) residual = (y - fitted_value) * xp.sqrt(w) wss_residual = xp.nansum(residual ** 2, axis) - mse_denom = xp.nansum((y * 0 + 1) * (w != 0), axis) - 1 + mse_denom = xp.nansum((y * 0 + 1) * (xp.nan_to_num(w) != 0), axis) - 1 mse_denom = num_to_nan(mse_denom) mse = wss_residual / mse_denom std_err = xp.sqrt(mse / d)