Skip to content

Reconciling to Mack papers#1096

Open
henrydingliu wants to merge 3 commits into
mainfrom
mack_fix
Open

Reconciling to Mack papers#1096
henrydingliu wants to merge 3 commits into
mainfrom
mack_fix

Conversation

@henrydingliu

@henrydingliu henrydingliu commented Jul 10, 2026

Copy link
Copy Markdown
Member

Summary of Changes

restoring mack calculations incorrectly changed in #952
expanded docstrings to avoid future confusion
added definitive reconciliation to Mack94 and Mack97
indirectly resolves un-executed but would-fail doctests

Related GitHub Issue(s)

refers #1093

Additional Context for Reviewers

  • I passed tests locally for both code (uv run pytest) and documentation changes (uv run jb build docs --builder=custom --custom-builder=doctest)

Note

Medium Risk
Changes core Mack stochastic quantities used by Development and MackChainladder; incorrect sigma would affect reserve uncertainty, but new paper reconciliation tests reduce regression risk.

Overview
Restores Mack (1997) sigma_ in WeightedRegression for through-origin OLS by setting sigma to sqrt(mse) instead of the prior formula tied to std_err and mse_denom, which had diverged from the papers (see #952). Docstrings and typing on WeightedRegression are expanded so sigma_ is documented as Mack’s process standard deviation, distinct from regression noise.

Adds regression tests that compare Development + MackChainladder outputs to published tables in Mack (1994) and Mack (1997) (sigma, LDF standard errors, IBNR standard errors). Removes the standalone test_sigma1 development test that only checked equality across averaging methods.

Reviewed by Cursor Bugbot for commit 97ab6d6. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown

Pyright Type Completeness

View the full pyright --verifytypes output for this commit

Project (full chainladder package, at this PR's head): 15.0% of exported symbols fully typed (191 / 1270)

Known Ambiguous Unknown Total
Project (head) 191 110 969 1270

Other symbols referenced but not exported by chainladder: 13

Known Ambiguous Unknown Total
Other (head) 3 1 9 13

Symbols without documentation:

  • Functions without docstring: 310
  • Functions without default param: 0
  • Classes without docstring: 10

Patch (exported symbols added or changed by this PR): 46.2% fully typed (6 / 13); 1 no longer exported

Known Ambiguous Unknown Total
Patch 6 5 2 13
Patch symbol details
Symbol Status Change
chainladder.methods.tests.test_mack.test_mack1994_hardcode ❌ unknown new
chainladder.methods.tests.test_mack.test_mack1997_hardcode ❌ unknown new
chainladder.utils.weighted_regression.WeightedRegression.__init__ ✅ known changed (was ❌ unknown)
chainladder.utils.weighted_regression.WeightedRegression.average ✅ known changed (was ❌ unknown)
chainladder.utils.weighted_regression.WeightedRegression.axis ✅ known changed (was ❌ unknown)
chainladder.utils.weighted_regression.WeightedRegression.exponent_ ⚠️ ambiguous changed (was ❌ unknown)
chainladder.utils.weighted_regression.WeightedRegression.sigma_ ⚠️ ambiguous changed (was ❌ unknown)
chainladder.utils.weighted_regression.WeightedRegression.std_err_ ⚠️ ambiguous changed (was ❌ unknown)
chainladder.utils.weighted_regression.WeightedRegression.thru_orig ✅ known changed (was ⚠️ ambiguous)
chainladder.utils.weighted_regression.WeightedRegression.w ⚠️ ambiguous changed (was ❌ unknown)
chainladder.utils.weighted_regression.WeightedRegression.x ⚠️ ambiguous changed (was ❌ unknown)
chainladder.utils.weighted_regression.WeightedRegression.xp ✅ known changed (was ❌ unknown)
chainladder.utils.weighted_regression.WeightedRegression.y ✅ known changed (was ❌ unknown)
chainladder.development.tests.test_development.test_sigma1 no longer exported (was ❌ unknown)

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit bc6d203. Configure here.

Comment thread chainladder/methods/tests/test_mack.py Outdated
@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.76%. Comparing base (6c9ce99) to head (97ab6d6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1096      +/-   ##
==========================================
+ Coverage   90.48%   90.76%   +0.28%     
==========================================
  Files          91       91              
  Lines        5289     5287       -2     
  Branches      671      671              
==========================================
+ Hits         4786     4799      +13     
+ Misses        359      346      -13     
+ Partials      144      142       -2     
Flag Coverage Δ
unittests 90.76% <100.00%> (+0.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@henrydingliu henrydingliu marked this pull request as ready for review July 10, 2026 04:13
This was referenced Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant