#272 added geometric averaging type to the Development() estimator#811
Conversation
…nto #272_geometric_LDFs
Co-authored-by: Kenneth Hsu <kennethshsu@users.noreply.github.com>
|
@henrydingliu ok ready for review! |
|
In case anyone wants to look at the Excel replication. |
| # but using the log link function and taking the differences | ||
| w_geo = num_to_nan(self.w) | ||
| geo_coef = xp.exp( | ||
| xp.nanmean(w_geo * xp.log(y), axis) |
There was a problem hiding this comment.
do we need any extra error catching around negative values ?
There was a problem hiding this comment.
I don't think a cumulative triangle can ever be negative. But I do a potential problem in an edge case where losses are 0 for the first few periods for a super long tailed business. In that case, the geometric LDFs will error out...
There was a problem hiding this comment.
geometric ldf is calculated regardless of whether it's selected, correct? so this could error out even when the user doesn't want geomean at all
There was a problem hiding this comment.
Yes, that's a good point, though not likely, but ya I can add a guard to skip if geometric is not present so it runs faster.
…nto #272_geometric_LDFs
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2737959. Configure here.
henrydingliu
left a comment
There was a problem hiding this comment.
harmonic mean next?
|
lol if you have the formulas we can do it, it's been refactored so should be pretty easy |

Summary of Changes
Added geometric LDFs in the
Development()estimator.Related GitHub Issue(s)
Additional Context for Reviewers
Because geometric averaging cannot be easily implemented in the regression framework, it is calculated outside. We then have to carefully
nanout all relevant params related to the estimated values, such assigma_,std_err_, andstd_residuals_.uv run pytest) and documentation changes (uv run jb build docs --builder=custom --custom-builder=doctest)Note
Medium Risk
Introduces a new averaging mode and rewires weighted regression/std-error calculations, which can change LDFs and stochastic outputs (
sigma_,std_err_, residuals) across workflows if behavior differs from prior methods.Overview
Adds geometric averaging as a supported
averageoption forDevelopment, including per-development-period mixing ofsimple/geometricmethods.Refactors
WeightedRegressionto accept the chosen averaging method, compute regression weights internally (tracking_w_reg/exponent_), handle geometric averaging via a log-based coefficient calculation with a new warning for zero values, and centralizesstd_err_filling via a newstd_err_fill()helper. UpdatesDevelopment.fit()to use these new regression outputs when computing standardized residuals.Expands the test suite to validate geometric/simple averaging results and to assert expected
sigma_,std_err_, andstd_residuals_values.Reviewed by Cursor Bugbot for commit 81cef7e. Bugbot is set up for automated code reviews on this repo. Configure here.