@actuarial-ts/core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +5 -0
  3. package/README.md +133 -0
  4. package/dist/benktander.d.ts +45 -0
  5. package/dist/benktander.d.ts.map +1 -0
  6. package/dist/benktander.js +38 -0
  7. package/dist/benktander.js.map +1 -0
  8. package/dist/berquist.d.ts +14 -0
  9. package/dist/berquist.d.ts.map +1 -0
  10. package/dist/berquist.js +292 -0
  11. package/dist/berquist.js.map +1 -0
  12. package/dist/bf.d.ts +23 -0
  13. package/dist/bf.d.ts.map +1 -0
  14. package/dist/bf.js +83 -0
  15. package/dist/bf.js.map +1 -0
  16. package/dist/capping.d.ts +96 -0
  17. package/dist/capping.d.ts.map +1 -0
  18. package/dist/capping.js +207 -0
  19. package/dist/capping.js.map +1 -0
  20. package/dist/caseOutstanding.d.ts +80 -0
  21. package/dist/caseOutstanding.d.ts.map +1 -0
  22. package/dist/caseOutstanding.js +147 -0
  23. package/dist/caseOutstanding.js.map +1 -0
  24. package/dist/chainladder.d.ts +15 -0
  25. package/dist/chainladder.d.ts.map +1 -0
  26. package/dist/chainladder.js +81 -0
  27. package/dist/chainladder.js.map +1 -0
  28. package/dist/clark.d.ts +91 -0
  29. package/dist/clark.d.ts.map +1 -0
  30. package/dist/clark.js +490 -0
  31. package/dist/clark.js.map +1 -0
  32. package/dist/diagnostics.d.ts +80 -0
  33. package/dist/diagnostics.d.ts.map +1 -0
  34. package/dist/diagnostics.js +359 -0
  35. package/dist/diagnostics.js.map +1 -0
  36. package/dist/discounting.d.ts +166 -0
  37. package/dist/discounting.d.ts.map +1 -0
  38. package/dist/discounting.js +210 -0
  39. package/dist/discounting.js.map +1 -0
  40. package/dist/elrMethods.d.ts +104 -0
  41. package/dist/elrMethods.d.ts.map +1 -0
  42. package/dist/elrMethods.js +151 -0
  43. package/dist/elrMethods.js.map +1 -0
  44. package/dist/factors.d.ts +19 -0
  45. package/dist/factors.d.ts.map +1 -0
  46. package/dist/factors.js +136 -0
  47. package/dist/factors.js.map +1 -0
  48. package/dist/fisherLange.d.ts +92 -0
  49. package/dist/fisherLange.d.ts.map +1 -0
  50. package/dist/fisherLange.js +224 -0
  51. package/dist/fisherLange.js.map +1 -0
  52. package/dist/freqSev.d.ts +57 -0
  53. package/dist/freqSev.d.ts.map +1 -0
  54. package/dist/freqSev.js +82 -0
  55. package/dist/freqSev.js.map +1 -0
  56. package/dist/ilf.d.ts +111 -0
  57. package/dist/ilf.d.ts.map +1 -0
  58. package/dist/ilf.js +449 -0
  59. package/dist/ilf.js.map +1 -0
  60. package/dist/index.d.ts +29 -0
  61. package/dist/index.d.ts.map +1 -0
  62. package/dist/index.js +29 -0
  63. package/dist/index.js.map +1 -0
  64. package/dist/mack.d.ts +55 -0
  65. package/dist/mack.d.ts.map +1 -0
  66. package/dist/mack.js +244 -0
  67. package/dist/mack.js.map +1 -0
  68. package/dist/merzWuthrich.d.ts +29 -0
  69. package/dist/merzWuthrich.d.ts.map +1 -0
  70. package/dist/merzWuthrich.js +132 -0
  71. package/dist/merzWuthrich.js.map +1 -0
  72. package/dist/munichChainLadder.d.ts +101 -0
  73. package/dist/munichChainLadder.d.ts.map +1 -0
  74. package/dist/munichChainLadder.js +254 -0
  75. package/dist/munichChainLadder.js.map +1 -0
  76. package/dist/odpBootstrap.d.ts +65 -0
  77. package/dist/odpBootstrap.d.ts.map +1 -0
  78. package/dist/odpBootstrap.js +243 -0
  79. package/dist/odpBootstrap.js.map +1 -0
  80. package/dist/onlevel.d.ts +39 -0
  81. package/dist/onlevel.d.ts.map +1 -0
  82. package/dist/onlevel.js +104 -0
  83. package/dist/onlevel.js.map +1 -0
  84. package/dist/salvageSubro.d.ts +82 -0
  85. package/dist/salvageSubro.d.ts.map +1 -0
  86. package/dist/salvageSubro.js +100 -0
  87. package/dist/salvageSubro.js.map +1 -0
  88. package/dist/stochastic.d.ts +56 -0
  89. package/dist/stochastic.d.ts.map +1 -0
  90. package/dist/stochastic.js +99 -0
  91. package/dist/stochastic.js.map +1 -0
  92. package/dist/tail.d.ts +18 -0
  93. package/dist/tail.d.ts.map +1 -0
  94. package/dist/tail.js +121 -0
  95. package/dist/tail.js.map +1 -0
  96. package/dist/trend.d.ts +46 -0
  97. package/dist/trend.d.ts.map +1 -0
  98. package/dist/trend.js +99 -0
  99. package/dist/trend.js.map +1 -0
  100. package/dist/triangle.d.ts +19 -0
  101. package/dist/triangle.d.ts.map +1 -0
  102. package/dist/triangle.js +163 -0
  103. package/dist/triangle.js.map +1 -0
  104. package/dist/triangleAlgebra.d.ts +10 -0
  105. package/dist/triangleAlgebra.d.ts.map +1 -0
  106. package/dist/triangleAlgebra.js +97 -0
  107. package/dist/triangleAlgebra.js.map +1 -0
  108. package/dist/types.d.ts +280 -0
  109. package/dist/types.d.ts.map +1 -0
  110. package/dist/types.js +79 -0
  111. package/dist/types.js.map +1 -0
  112. package/dist/ulae.d.ts +172 -0
  113. package/dist/ulae.d.ts.map +1 -0
  114. package/dist/ulae.js +164 -0
  115. package/dist/ulae.js.map +1 -0
  116. package/dist/util.d.ts +24 -0
  117. package/dist/util.d.ts.map +1 -0
  118. package/dist/util.js +66 -0
  119. package/dist/util.js.map +1 -0
  120. package/package.json +66 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,5 @@
1
+ actuarial-ts
2
+ Copyright 2026 Justin Morrey
3
+
4
+ This product includes software developed as part of the actuarial-ts project
5
+ (https://github.com/yerromnitsuj/actng).
package/README.md ADDED
@@ -0,0 +1,133 @@
1
+ # @actuarial-ts/core
2
+
3
+ A pure, zero-dependency P&C loss reserving engine for TypeScript. The
4
+ deterministic shelf: triangles, development factors, chain ladder,
5
+ Bornhuetter-Ferguson, Benktander, Cape Cod (with the Gluck decay
6
+ generalization), Expected Claims, frequency-severity, Berquist-Sherman,
7
+ Munich chain ladder, case-outstanding development, Fisher-Lange,
8
+ salvage/subrogation, ULAE, tail fitting, large-loss capping and ILF
9
+ restoration, trend and premium on-leveling, discounting (built to the June
10
+ 2026 ASOP No. 20), and assumption diagnostics. The stochastic layer, fully
11
+ seeded and reproducible: Mack standard errors, the ODP bootstrap,
12
+ Merz-Wuthrich one-year risk, and Clark growth-curve MLE — every method
13
+ validated against published actuarial literature where published values
14
+ exist.
15
+
16
+ `@actuarial-ts/core` is the numeric kernel of the actuarial-ts SDK. It is
17
+ **designed to support the actuary's compliance with the Actuarial Standards of
18
+ Practice** (ASOP Nos. 43, 23, 41, 56, 25, 36, 20, 21, 38, and 13) by making
19
+ methods, assumptions, and their diagnostics explicit and reportable.
20
+ Responsibility for compliance remains with the credentialed actuary; no
21
+ software can be "ASOP-approved" and this one does not claim to be.
22
+
23
+ ## Install
24
+
25
+ ```bash
26
+ npm install @actuarial-ts/core
27
+ ```
28
+
29
+ ESM, TypeScript-first, zero runtime dependencies, Node >= 20.
30
+
31
+ ## Quick start
32
+
33
+ ```ts
34
+ import {
35
+ buildTriangles,
36
+ computeDevelopmentFactors,
37
+ runChainLadder,
38
+ runMack,
39
+ fitAllTails,
40
+ } from "@actuarial-ts/core";
41
+
42
+ // One row per claim per evaluation snapshot (the standard loss-run shape).
43
+ const { paid, incurred } = buildTriangles(claimSnapshots, {
44
+ cadence: "annual",
45
+ asOfDate: "2025-12-31",
46
+ });
47
+
48
+ // The averages menu: all-year/n-year straight and volume-weighted, medial,
49
+ // geometric. Selection is YOUR judgment; the engine never picks for you.
50
+ const factors = computeDevelopmentFactors(paid);
51
+ const selected = factors.averages.find((a) => a.spec.key === "all-wtd")!.values;
52
+
53
+ const tails = fitAllTails(selected);
54
+ const tail = tails.exponentialDecay.valid ? tails.exponentialDecay.tailFactor : 1;
55
+
56
+ const cl = runChainLadder(paid, { selected, tailFactor: tail });
57
+ const mack = runMack(paid, { selected, tailFactor: tail });
58
+
59
+ console.log(cl.totals.unpaid, mack.totals.standardError, cl.warnings);
60
+ ```
61
+
62
+ ## The contract
63
+
64
+ Three rules hold everywhere:
65
+
66
+ 1. **Null is a first-class citizen.** Unobservable triangle cells are `null`.
67
+ Division by a missing, zero, or negative denominator yields `null` ("no
68
+ factor") — never an exception, never `NaN`.
69
+ 2. **Three-tier severity.** Impossible input throws `ReservingError` with a
70
+ machine-readable code from the exported `RESERVING_ERROR_CODES` registry.
71
+ Degraded-but-legal situations compute anyway and explain themselves in the
72
+ result's `warnings: string[]`. Missing data is `null`, not an error.
73
+ 3. **Judgment belongs to the caller.** The engine computes evidence (factor
74
+ menus, tail fits, diagnostics) and applies *your* selections (LDFs, tails,
75
+ a-prioris, trends, caps). It never silently selects.
76
+
77
+ ## Method inventory
78
+
79
+ | Module | Methods | Primary literature |
80
+ |---|---|---|
81
+ | `triangle` | `buildTriangles` (7 triangle kinds from claim-level snapshots, annual/quarterly), `triangleFromGrid` | Friedland, *Estimating Unpaid Claims Using Basic Techniques* |
82
+ | `factors` | `computeDevelopmentFactors` (averages menu), `factorVolatility` | Friedland ch. 7; Mack (1993) factor conventions |
83
+ | `chainladder` | `runChainLadder` | Friedland ch. 7 |
84
+ | `mack` | `runMack` — distribution-free standard errors on the selected basis, with tail | Mack (1993) ASTIN 23(2); Mack (1999) ASTIN 29(2) |
85
+ | `bf` | `runBornhuetterFerguson` (per-origin/global/derived a-priori) | Bornhuetter & Ferguson (1972) |
86
+ | `elrMethods` | `runCapeCod`, `runExpectedClaims` | Stanard-Buhlmann; Friedland chs. 8, 10 |
87
+ | `tail` | `fitTail`, `fitAllTails` (exponential decay, Sherman inverse power, validity gates) | Sherman (1984); Boor (2006) |
88
+ | `berquist` | `berquistCaseAdequacy`, `berquistSettlement` | Berquist & Sherman (1977); Friedland ch. 13 |
89
+ | `benktander` | `runBenktander` — the iterated BF credibility blend | Mack (2000) ASTIN 30(2); Benktander (1976) |
90
+ | `freqSev` | `runFrequencySeverity`, `severityTriangle` | Friedland ch. 11 |
91
+ | `munichChainLadder` | `runMunichChainLadder` — closes the paid/incurred gap | Quarg & Mack (2004), Variance 2:2 |
92
+ | `caseOutstanding` | `runCaseOutstanding` | Friedland ch. 12 |
93
+ | `fisherLange` | `runFisherLange` — disposal-rate frequency-severity | Fisher & Lange (1973); Friedland ch. 11 |
94
+ | `salvageSubro` | `runSalvageSubro`, `netOfRecoveries` | Friedland ch. 14 |
95
+ | `ulae` | `ulaeRatios`, `ulaeReserve`, `ULAE_WEIGHT_PRESETS` | Conger & Nolibos (2003); Kittel (1981) |
96
+ | `discounting` | `payoutPatternFromChainLadder`, `discountUnpaid` | ASOP No. 20 (June 2026 edition) |
97
+ | `stochastic` | `createRng` (seeded), `summarizeSample`, `StochasticResult` | — |
98
+ | `triangleAlgebra` | `cumulativeToIncremental`, `incrementalToCumulative`, `addTriangles`, `subtractTriangles` | — |
99
+ | `odpBootstrap` | `odpFit` (GLM == chain ladder identity), `runOdpBootstrap` | England & Verrall (1999/2002); Shapland, CAS Monograph 4 |
100
+ | `merzWuthrich` | `runMerzWuthrich` — one-year CDR MSEP vs Mack's ultimate view | Merz & Wuthrich (2008), CAS E-Forum |
101
+ | `clark` | `clarkGrowth`, `runClarkLdf`, `runClarkCapeCod` — MLE + delta-method variances | Clark (2003), CAS Forum |
102
+ | `capping` | `capClaims`, `claimSizeDiagnostics` (per-occurrence caps, indexed) | standard large-loss practice |
103
+ | `ilf` | censored-MLE severity fits (lognormal, Pareto), Kaplan-Meier checks, ILF table interpolation, uncap factors | Klugman et al., *Loss Models*; standard ILF practice |
104
+ | `trend` | `analyzeTrend`, `trendValue` (log-linear, windowed) | Werner & Modlin, *Basic Ratemaking* ch. 6 |
105
+ | `onlevel` | `parallelogramOnLevel` (exact piecewise-linear earning geometry) | Werner & Modlin ch. 5 |
106
+ | `diagnostics` | `runDiagnostics` (paid/incurred drift, case adequacy, closure rates), `calendarYearTest` | Mack (1994) calendar-year rank test |
107
+
108
+ ## Validation against published results
109
+
110
+ The test suite reproduces, from the primary sources (transcriptions under
111
+ `docs/research/` in the repository):
112
+
113
+ - Mack (1993), ASTIN 23(2): Taylor/Ashe and mortgage-guarantee factors,
114
+ reserves, sigma-squared (including the extrapolated column), standard errors.
115
+ - Mack (1994), CAS Forum: the RAA triangle's calendar-year test (Appendix H)
116
+ and factor-correlation test (Appendix G), every printed statistic.
117
+ - Mack (1999), ASTIN 29(2): ultimates under the published 1.05 tail.
118
+ - Mack (2000), ASTIN 30(2): the Benktander numerical example.
119
+ - Gluck (1997), PCAS LXXXIV: Generalized Cape Cod Tables 1-4.
120
+ - England (2002), IME 31: ODP bootstrap prediction errors and percentiles
121
+ on Taylor/Ashe.
122
+ - Merz & Wuthrich (2008): the Table 4 one-year CDR volatilities.
123
+ - Clark (2003): both methods' fitted parameters, reserves, and variance
124
+ decompositions (to ~1e-5).
125
+ - Quarg & Mack (2004): the fire-portfolio example's every printed parameter
126
+ row and projected cell.
127
+
128
+ These published-value tests are the package's change contract: math changes
129
+ are wrong until they pass.
130
+
131
+ ## License
132
+
133
+ Apache-2.0. Copyright 2026 Justin Morrey.
@@ -0,0 +1,45 @@
1
+ import type { BornhuetterFergusonResult, ChainLadderResult } from "./types.js";
2
+ /**
3
+ * Benktander-Hovinen method (the "iterated Bornhuetter-Ferguson").
4
+ *
5
+ * Ground truth (Mack 2000, "Credible Claims Reserves: The Benktander
6
+ * Method", ASTIN Bulletin 30(2)):
7
+ * - With q = 1 - 1/CDF (the expected unreported/unpaid fraction) and C the
8
+ * losses to date: U_GB = C + q x U_BF — Bornhuetter-Ferguson applied once
9
+ * more, with the BF ultimate as the a-priori.
10
+ * - Equivalently a credibility mixture U_GB = (1-q) x U_CL + q x U_BF with
11
+ * credibility Z = 1-q on the chain ladder: mature periods lean on CL,
12
+ * green periods lean on the a-priori — automatically.
13
+ * - Mack (2000) shows U_GB has a smaller mean squared error than both CL and
14
+ * BF over a wide parameter range; it is the standard "use both" answer.
15
+ *
16
+ * Rows are the BF result's rows (BF excludes origins with no usable
17
+ * premium; those stay excluded here). CDFs below 1 (incurred bases with
18
+ * expected downward development) make q negative — the estimator still
19
+ * evaluates, but it is an extrapolation past the chain ladder rather than a
20
+ * mixture, and the result says so in warnings.
21
+ */
22
+ export interface BenktanderRow {
23
+ origin: string;
24
+ latestValue: number;
25
+ cdf: number;
26
+ /** Credibility on the chain ladder: Z = 1 - q = 1/CDF. */
27
+ credibilityZ: number;
28
+ clUltimate: number;
29
+ bfUltimate: number;
30
+ ultimate: number;
31
+ unpaid: number;
32
+ }
33
+ export interface BenktanderResult {
34
+ method: "benktander";
35
+ basis: BornhuetterFergusonResult["basis"];
36
+ rows: BenktanderRow[];
37
+ totals: {
38
+ latest: number;
39
+ ultimate: number;
40
+ unpaid: number;
41
+ };
42
+ warnings: string[];
43
+ }
44
+ export declare function runBenktander(chainLadder: ChainLadderResult, bf: BornhuetterFergusonResult): BenktanderResult;
45
+ //# sourceMappingURL=benktander.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"benktander.d.ts","sourceRoot":"","sources":["../src/benktander.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG/E;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,0DAA0D;IAC1D,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAC1C,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7D,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAgB,aAAa,CAC3B,WAAW,EAAE,iBAAiB,EAC9B,EAAE,EAAE,yBAAyB,GAC5B,gBAAgB,CA0ClB"}
@@ -0,0 +1,38 @@
1
+ import { ReservingError } from "./types.js";
2
+ export function runBenktander(chainLadder, bf) {
3
+ const warnings = [];
4
+ const clByOrigin = new Map(chainLadder.rows.map((r) => [r.origin, r]));
5
+ const rows = bf.rows.map((bfRow) => {
6
+ const cl = clByOrigin.get(bfRow.origin);
7
+ if (!cl) {
8
+ throw new ReservingError("SHAPE", `Origin ${bfRow.origin} is in the Bornhuetter-Ferguson result but missing from the chain ladder result; both must come from the same run`);
9
+ }
10
+ const q = 1 - 1 / bfRow.cdf;
11
+ if (q < 0) {
12
+ warnings.push(`Origin ${bfRow.origin}: CDF ${bfRow.cdf.toFixed(3)} is below 1, so Benktander extrapolates past the chain ladder rather than blending (expected downward development)`);
13
+ }
14
+ const ultimate = bfRow.latestValue + q * bfRow.ultimate;
15
+ return {
16
+ origin: bfRow.origin,
17
+ latestValue: bfRow.latestValue,
18
+ cdf: bfRow.cdf,
19
+ credibilityZ: 1 - q,
20
+ clUltimate: cl.ultimate,
21
+ bfUltimate: bfRow.ultimate,
22
+ ultimate,
23
+ unpaid: ultimate - bfRow.latestValue,
24
+ };
25
+ });
26
+ return {
27
+ method: "benktander",
28
+ basis: bf.basis,
29
+ rows,
30
+ totals: {
31
+ latest: rows.reduce((a, r) => a + r.latestValue, 0),
32
+ ultimate: rows.reduce((a, r) => a + r.ultimate, 0),
33
+ unpaid: rows.reduce((a, r) => a + r.unpaid, 0),
34
+ },
35
+ warnings,
36
+ };
37
+ }
38
+ //# sourceMappingURL=benktander.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"benktander.js","sourceRoot":"","sources":["../src/benktander.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA2C5C,MAAM,UAAU,aAAa,CAC3B,WAA8B,EAC9B,EAA6B;IAE7B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAEvE,MAAM,IAAI,GAAoB,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAClD,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,MAAM,IAAI,cAAc,CACtB,OAAO,EACP,UAAU,KAAK,CAAC,MAAM,mHAAmH,CAC1I,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC;QAC5B,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACV,QAAQ,CAAC,IAAI,CACX,UAAU,KAAK,CAAC,MAAM,SAAS,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,oHAAoH,CACxK,CAAC;QACJ,CAAC;QACD,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC;QACxD,OAAO;YACL,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,GAAG,EAAE,KAAK,CAAC,GAAG;YACd,YAAY,EAAE,CAAC,GAAG,CAAC;YACnB,UAAU,EAAE,EAAE,CAAC,QAAQ;YACvB,UAAU,EAAE,KAAK,CAAC,QAAQ;YAC1B,QAAQ;YACR,MAAM,EAAE,QAAQ,GAAG,KAAK,CAAC,WAAW;SACrC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,MAAM,EAAE,YAAY;QACpB,KAAK,EAAE,EAAE,CAAC,KAAK;QACf,IAAI;QACJ,MAAM,EAAE;YACN,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;YACnD,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;YAClD,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;SAC/C;QACD,QAAQ;KACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { BerquistCaseAdequacyResult, BerquistSettlementResult, Triangle } from "./types.js";
2
+ export interface CaseAdequacyOptions {
3
+ /** Annual severity trend override (e.g. 0.15 for +15%/yr). Fitted when omitted. */
4
+ severityTrend?: number;
5
+ }
6
+ export declare function berquistCaseAdequacy(paid: Triangle, incurred: Triangle, openCounts: Triangle, options?: CaseAdequacyOptions): BerquistCaseAdequacyResult;
7
+ export interface SettlementOptions {
8
+ /** Selected ultimate claim counts per origin (same order as triangle origins). */
9
+ ultimateCounts: number[];
10
+ /** Interpolation between (closed count, paid) points. Friedland uses exponential. */
11
+ interpolation?: "exponential" | "linear";
12
+ }
13
+ export declare function berquistSettlement(paid: Triangle, closedCounts: Triangle, options: SettlementOptions): BerquistSettlementResult;
14
+ //# sourceMappingURL=berquist.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"berquist.d.ts","sourceRoot":"","sources":["../src/berquist.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,wBAAwB,EACxB,QAAQ,EACT,MAAM,YAAY,CAAC;AAsCpB,MAAM,WAAW,mBAAmB;IAClC,mFAAmF;IACnF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,QAAQ,EACpB,OAAO,GAAE,mBAAwB,GAChC,0BAA0B,CAiI5B;AAED,MAAM,WAAW,iBAAiB;IAChC,kFAAkF;IAClF,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,qFAAqF;IACrF,aAAa,CAAC,EAAE,aAAa,GAAG,QAAQ,CAAC;CAC1C;AA6DD,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,QAAQ,EACd,YAAY,EAAE,QAAQ,EACtB,OAAO,EAAE,iBAAiB,GACzB,wBAAwB,CA+F1B"}