@actuarial-ts/core 0.5.0 → 0.6.1
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.
- package/README.md +65 -226
- package/dist/capping.d.ts.map +1 -1
- package/dist/capping.js +39 -6
- package/dist/capping.js.map +1 -1
- package/dist/casualtyDiagnostics.d.ts +19 -49
- package/dist/casualtyDiagnostics.d.ts.map +1 -1
- package/dist/casualtyDiagnostics.js +84 -116
- package/dist/casualtyDiagnostics.js.map +1 -1
- package/dist/diagnosticAggregation.d.ts +32 -0
- package/dist/diagnosticAggregation.d.ts.map +1 -0
- package/dist/diagnosticAggregation.js +73 -0
- package/dist/diagnosticAggregation.js.map +1 -0
- package/dist/diagnosticDefinitions.d.ts +289 -0
- package/dist/diagnosticDefinitions.d.ts.map +1 -0
- package/dist/diagnosticDefinitions.js +1688 -0
- package/dist/diagnosticDefinitions.js.map +1 -0
- package/dist/diagnosticDerivations.d.ts +35 -0
- package/dist/diagnosticDerivations.d.ts.map +1 -0
- package/dist/diagnosticDerivations.js +224 -0
- package/dist/diagnosticDerivations.js.map +1 -0
- package/dist/diagnosticExposure.d.ts +51 -0
- package/dist/diagnosticExposure.d.ts.map +1 -0
- package/dist/diagnosticExposure.js +273 -0
- package/dist/diagnosticExposure.js.map +1 -0
- package/dist/diagnosticExpressions.d.ts +56 -0
- package/dist/diagnosticExpressions.d.ts.map +1 -0
- package/dist/diagnosticExpressions.js +124 -0
- package/dist/diagnosticExpressions.js.map +1 -0
- package/dist/diagnosticFormulas.d.ts +198 -0
- package/dist/diagnosticFormulas.d.ts.map +1 -0
- package/dist/diagnosticFormulas.js +219 -0
- package/dist/diagnosticFormulas.js.map +1 -0
- package/dist/diagnosticIdentity.d.ts +251 -0
- package/dist/diagnosticIdentity.d.ts.map +1 -0
- package/dist/diagnosticIdentity.js +721 -0
- package/dist/diagnosticIdentity.js.map +1 -0
- package/dist/diagnosticOrdering.d.ts +8 -0
- package/dist/diagnosticOrdering.d.ts.map +1 -0
- package/dist/diagnosticOrdering.js +73 -0
- package/dist/diagnosticOrdering.js.map +1 -0
- package/dist/diagnosticPeriodAxis.d.ts +9 -0
- package/dist/diagnosticPeriodAxis.d.ts.map +1 -0
- package/dist/diagnosticPeriodAxis.js +69 -0
- package/dist/diagnosticPeriodAxis.js.map +1 -0
- package/dist/diagnosticPeriods.d.ts +15 -0
- package/dist/diagnosticPeriods.d.ts.map +1 -0
- package/dist/diagnosticPeriods.js +50 -0
- package/dist/diagnosticPeriods.js.map +1 -0
- package/dist/diagnosticPreparation.d.ts +131 -0
- package/dist/diagnosticPreparation.d.ts.map +1 -0
- package/dist/diagnosticPreparation.js +1539 -0
- package/dist/diagnosticPreparation.js.map +1 -0
- package/dist/diagnosticReview.d.ts +66 -0
- package/dist/diagnosticReview.d.ts.map +1 -0
- package/dist/diagnosticReview.js +490 -0
- package/dist/diagnosticReview.js.map +1 -0
- package/dist/diagnosticRules.d.ts +32 -0
- package/dist/diagnosticRules.d.ts.map +1 -0
- package/dist/diagnosticRules.js +32 -0
- package/dist/diagnosticRules.js.map +1 -0
- package/dist/diagnosticRunner.d.ts +86 -0
- package/dist/diagnosticRunner.d.ts.map +1 -0
- package/dist/diagnosticRunner.js +703 -0
- package/dist/diagnosticRunner.js.map +1 -0
- package/dist/diagnosticRuntime.d.ts +26 -0
- package/dist/diagnosticRuntime.d.ts.map +1 -0
- package/dist/diagnosticRuntime.js +243 -0
- package/dist/diagnosticRuntime.js.map +1 -0
- package/dist/diagnosticSourceOrdering.d.ts +6 -0
- package/dist/diagnosticSourceOrdering.d.ts.map +1 -0
- package/dist/diagnosticSourceOrdering.js +38 -0
- package/dist/diagnosticSourceOrdering.js.map +1 -0
- package/dist/index.d.ts +28 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/dist/mack.d.ts +4 -0
- package/dist/mack.d.ts.map +1 -1
- package/dist/mack.js +32 -4
- package/dist/mack.js.map +1 -1
- package/dist/triangle.d.ts.map +1 -1
- package/dist/triangle.js +59 -9
- package/dist/triangle.js.map +1 -1
- package/dist/types.d.ts +21 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +128 -0
- package/dist/types.js.map +1 -1
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/package.json +4 -3
- package/src/capping.ts +109 -18
- package/src/casualtyDiagnostics.ts +79 -189
- package/src/diagnosticAggregation.ts +128 -0
- package/src/diagnosticDefinitions.ts +3624 -0
- package/src/diagnosticDerivations.ts +321 -0
- package/src/diagnosticExposure.ts +482 -0
- package/src/diagnosticExpressions.ts +255 -0
- package/src/diagnosticFormulas.ts +350 -0
- package/src/diagnosticIdentity.ts +1267 -0
- package/src/diagnosticOrdering.ts +106 -0
- package/src/diagnosticPeriodAxis.ts +92 -0
- package/src/diagnosticPeriods.ts +102 -0
- package/src/diagnosticPreparation.ts +2475 -0
- package/src/diagnosticReview.ts +897 -0
- package/src/diagnosticRules.ts +69 -0
- package/src/diagnosticRunner.ts +1114 -0
- package/src/diagnosticRuntime.ts +264 -0
- package/src/diagnosticSourceOrdering.ts +50 -0
- package/src/index.ts +184 -1
- package/src/mack.ts +72 -9
- package/src/triangle.ts +103 -13
- package/src/types.ts +196 -0
- package/src/version.ts +2 -0
- package/dist/metricDiagnostics.d.ts +0 -212
- package/dist/metricDiagnostics.d.ts.map +0 -1
- package/dist/metricDiagnostics.js +0 -627
- package/dist/metricDiagnostics.js.map +0 -1
- package/src/metricDiagnostics.ts +0 -876
package/README.md
CHANGED
|
@@ -1,255 +1,94 @@
|
|
|
1
1
|
# @actuarial-ts/core
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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, 20, and 21) 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.
|
|
3
|
+
Pure, framework-free P&C actuarial math for TypeScript. It includes triangles, deterministic and stochastic reserving, trends/on-leveling, limits and ILFs, discounting, and generalized definition-driven casualty diagnostics.
|
|
4
|
+
|
|
5
|
+
The package is designed to support the actuary's compliance with the ASOPs; it does not make a work product compliant and is not “ASOP-approved.” The credentialed actuary remains responsible for data, assumptions, selections, review, and communication.
|
|
22
6
|
|
|
23
7
|
## Install
|
|
24
8
|
|
|
25
9
|
```bash
|
|
26
|
-
npm install @actuarial-ts/core
|
|
10
|
+
npm install @actuarial-ts/core@0.6.1
|
|
27
11
|
```
|
|
28
12
|
|
|
29
|
-
ESM, TypeScript-first, zero runtime dependencies, Node
|
|
13
|
+
ESM, TypeScript-first, zero runtime dependencies, Node 20+.
|
|
30
14
|
|
|
31
|
-
##
|
|
15
|
+
## Reserving quick start
|
|
32
16
|
|
|
33
17
|
```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
|
-
});
|
|
18
|
+
import { buildTriangles, computeDevelopmentFactors, runChainLadder, runMack } from "@actuarial-ts/core";
|
|
47
19
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
const
|
|
20
|
+
const { paid } = buildTriangles(claimSnapshots, { cadence: "annual", asOfDate: "2025-12-31" });
|
|
21
|
+
const selected = computeDevelopmentFactors(paid).averages.find((item) => item.spec.key === "all-wtd")!.values;
|
|
22
|
+
const chainLadder = runChainLadder(paid, { selected, tailFactor: 1.02 });
|
|
23
|
+
const mack = runMack(paid, { selected, tailFactor: 1.02 });
|
|
24
|
+
```
|
|
52
25
|
|
|
53
|
-
|
|
54
|
-
const tail = tails.exponentialDecay.valid ? tails.exponentialDecay.tailFactor : 1;
|
|
26
|
+
Unobservable triangle cells are `null`. Volume-weighted factors are sum/sum over rows where both cells exist. CDFs multiply right-to-left, tail last. Missing, zero, or negative divisors yield `null`, never `NaN`.
|
|
55
27
|
|
|
56
|
-
|
|
57
|
-
const mack = runMack(paid, { selected, tailFactor: tail });
|
|
28
|
+
## Generalized diagnostics
|
|
58
29
|
|
|
59
|
-
|
|
60
|
-
```
|
|
30
|
+
The model deliberately separates five concerns:
|
|
61
31
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
| `metricDiagnostics` | generic ratio-of-sums metrics, claim-level amount layers, emergence/triangle/maturity views, optional 22-metric casualty preset | actuarial diagnostic practice |
|
|
108
|
-
| `periods` | quarterly parse/format/compare, development age, fiscal/policy mapping, complete-quarter cutoffs | explicit SDK conventions |
|
|
109
|
-
| `canonical` | `canonicalJson` (RFC 8785 / JCS canonical serialization), `fnv1a64` (integrity tagging aid — not a security control) | RFC 8785 |
|
|
110
|
-
|
|
111
|
-
## Quarterly metric diagnostics
|
|
112
|
-
|
|
113
|
-
`runMetricDiagnostics` is the generic engine behind the optional
|
|
114
|
-
`CASUALTY_QUARTERLY_METRICS` preset. A metric is a versioned definition with
|
|
115
|
-
caller-selected additive component expressions. The engine sums components at
|
|
116
|
-
the requested group/origin/valuation grain and divides once; it never averages
|
|
117
|
-
row ratios. Each result retains the raw numerator, denominator, component
|
|
118
|
-
values, labels, basis, scale, and structured warnings.
|
|
32
|
+
1. A measure declares source, quantity kind, unit, development semantics, sum aggregation, missingness, and its population/basis.
|
|
33
|
+
2. A formula template declares reusable arithmetic over typed roles.
|
|
34
|
+
3. An instance binds formula roles to measure expressions.
|
|
35
|
+
4. Calculation identity covers arithmetic, bindings, and all dependent measure/population/basis semantics.
|
|
36
|
+
5. Presentation and review rules remain visible in full definition identity without pretending to change the arithmetic.
|
|
119
37
|
|
|
120
38
|
```ts
|
|
121
39
|
import {
|
|
122
|
-
|
|
40
|
+
CASUALTY_FORMULA_TEMPLATES,
|
|
41
|
+
compileDiagnosticDefinition,
|
|
42
|
+
createCasualtyMetricInstances,
|
|
43
|
+
prepareDiagnosticData,
|
|
123
44
|
runMetricDiagnostics,
|
|
124
45
|
} from "@actuarial-ts/core";
|
|
125
46
|
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
policyPeriod: "PY2024",
|
|
134
|
-
measures: {
|
|
135
|
-
reportedCount: 80,
|
|
136
|
-
openCount: 30,
|
|
137
|
-
closedNoPayCount: 20,
|
|
138
|
-
closedWithPayCount: 30,
|
|
139
|
-
paid250: 450_000,
|
|
140
|
-
incurred250: 700_000,
|
|
141
|
-
paidPrimary: 600_000,
|
|
142
|
-
incurredPrimary: 950_000,
|
|
143
|
-
},
|
|
144
|
-
}],
|
|
145
|
-
exposures: [{
|
|
146
|
-
key: "fleet-2025Q1",
|
|
147
|
-
group: "commercial-auto",
|
|
148
|
-
origin: "2025Q1",
|
|
149
|
-
measures: { exposure: 1_600_000 },
|
|
150
|
-
}],
|
|
151
|
-
metrics: CASUALTY_QUARTERLY_METRICS,
|
|
47
|
+
const instances = createCasualtyMetricInstances({
|
|
48
|
+
counts: { reported: "reported", open: "open", closedNoPay: "closed-no-pay", closedWithPay: "closed-with-pay" },
|
|
49
|
+
exposure: "earned-vehicle-years",
|
|
50
|
+
amountBindings: [
|
|
51
|
+
{ id: "gross", paid: "gross-paid", incurred: "gross-incurred" },
|
|
52
|
+
{ id: "primary-250k", paid: "primary-paid", incurred: "primary-incurred" },
|
|
53
|
+
],
|
|
152
54
|
});
|
|
153
55
|
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
56
|
+
const compiled = compileDiagnosticDefinition({
|
|
57
|
+
diagnosticDefinitionVersion: "1.0.0",
|
|
58
|
+
id: "fleet-diagnostics",
|
|
59
|
+
version: "1.0.0",
|
|
60
|
+
lossRowGrain: "aggregate",
|
|
61
|
+
measures,
|
|
62
|
+
countPopulations,
|
|
63
|
+
exposureBases,
|
|
64
|
+
amountBases,
|
|
65
|
+
derivedMeasures: [],
|
|
66
|
+
formulas: CASUALTY_FORMULA_TEMPLATES,
|
|
67
|
+
instances,
|
|
68
|
+
reviewRules,
|
|
69
|
+
periodAxis,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const prepared = prepareDiagnosticData({ definition: compiled, losses, exposures });
|
|
73
|
+
const result = runMetricDiagnostics({ prepared, groupMap: { fleet: "all-fleet" } });
|
|
157
74
|
```
|
|
158
75
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
`INCOMPLETE_EXPOSURE` warning instead of using a partial denominator. Dated
|
|
175
|
-
exposure copies honor valuation filters, while exposure rows without a
|
|
176
|
-
valuation remain timeless.
|
|
177
|
-
|
|
178
|
-
The preset's count-share definitions include the reported-base ratios
|
|
179
|
-
`CNP / reported`, `CWP / reported`, and `open / reported`, plus two
|
|
180
|
-
non-CNP-base ratios:
|
|
181
|
-
|
|
182
|
-
- `closed-with-pay-share-of-non-cnp` = `CWP / (reported - CNP)`
|
|
183
|
-
- `open-share-of-non-cnp` = `open / (reported - CNP)`
|
|
184
|
-
|
|
185
|
-
Both use the ordinary metric evaluator, so aggregation is a ratio of component
|
|
186
|
-
sums and a non-positive or incomplete `reported - CNP` denominator fails
|
|
187
|
-
closed with the standard structured warnings.
|
|
188
|
-
|
|
189
|
-
### Amount layers
|
|
190
|
-
|
|
191
|
-
`deriveAmountLayers` evaluates a declarative layer on each claim row before
|
|
192
|
-
aggregation. `CASUALTY_AMOUNT_LAYERS` documents two reference bases:
|
|
193
|
-
|
|
194
|
-
- `$250K pre-capped total` reads already-limited paid and incurred components
|
|
195
|
-
as additive measures. The SDK does not attempt to recreate a lost
|
|
196
|
-
claim-level cap from an aggregate.
|
|
197
|
-
- `Primary: $1M capped indemnity plus unlimited expense` caps paid and incurred
|
|
198
|
-
indemnity on each claim row, then adds expense without a cap.
|
|
199
|
-
|
|
200
|
-
This distinction is intentional: capping an aggregate after summation is not
|
|
201
|
-
equivalent to a claim-level layer and is not offered by the API.
|
|
202
|
-
`createCasualtyAmountLayers` configures every source/output key, identifier,
|
|
203
|
-
display label, and indemnity limit; arbitrary caller layers can be authored
|
|
204
|
-
directly as `AmountLayerDefinition` values.
|
|
205
|
-
|
|
206
|
-
### Views and periods
|
|
207
|
-
|
|
208
|
-
The engine derives audited emergence points, nullable metric triangles, and a
|
|
209
|
-
ragged latest diagonal from the same aggregated records. `sameMaturity` and
|
|
210
|
-
`commonMaturity` select comparable points for any caller group IDs.
|
|
211
|
-
`parseQuarterPeriod`, `compareQuarterPeriods`, `developmentAgeMonths`,
|
|
212
|
-
`policyPeriodLabel`, `completeQuarterCutoff`, and
|
|
213
|
-
`completeQuarterlyCutoffs` make period assumptions explicit. The default
|
|
214
|
-
quarter-end convention starts at age 3; select the `elapsed` convention only
|
|
215
|
-
for genuine age-zero observations.
|
|
216
|
-
|
|
217
|
-
Core results deliberately contain no provenance, persistence state, or
|
|
218
|
-
arbitrary application filter state. Use `createDiagnosticsProvenance` from
|
|
219
|
-
`@actuarial-ts/compliance`, embed its record in
|
|
220
|
-
`createBundle(...).parameters`, and record material judgment in the assumption
|
|
221
|
-
ledger. Interchange consumers can carry the same record in `extensions`. No
|
|
222
|
-
diagnostic-specific interchange schema is claimed.
|
|
223
|
-
|
|
224
|
-
## Validation against published results
|
|
225
|
-
|
|
226
|
-
The test suite reproduces the following, each transcribed from the primary
|
|
227
|
-
source into `test/fixtures/`. Five of them additionally carry a full research
|
|
228
|
-
transcription with context and caveats under `docs/research/` (Clark,
|
|
229
|
-
Merz-Wuthrich, England/Verrall, Munich, ULAE); for the rest the transcription
|
|
230
|
-
notes live in the fixture file itself.
|
|
231
|
-
|
|
232
|
-
- Mack (1993), ASTIN 23(2): Taylor/Ashe and mortgage-guarantee factors,
|
|
233
|
-
reserves, sigma-squared (including the extrapolated column), standard errors.
|
|
234
|
-
- Mack (1994), CAS Forum: the RAA triangle's calendar-year test (Appendix H)
|
|
235
|
-
and factor-correlation test (Appendix G), every printed statistic.
|
|
236
|
-
- Mack (1999), ASTIN 29(2): ultimates under the published 1.05 tail.
|
|
237
|
-
- Mack (2000), ASTIN 30(2): the Benktander numerical example.
|
|
238
|
-
- Gluck (1997), PCAS LXXXIV: Generalized Cape Cod Tables 1-4.
|
|
239
|
-
- England (2002), IME 31: ODP bootstrap prediction errors and percentiles
|
|
240
|
-
on Taylor/Ashe — all nine published accident years plus the Table 3
|
|
241
|
-
predictive distribution. Asserted within the sampling error the publication
|
|
242
|
-
itself exhibits, because a bootstrap figure is one finite sample and cannot
|
|
243
|
-
be reproduced to the digit the way Mack's closed form can.
|
|
244
|
-
- Merz & Wuthrich (2008): the Table 4 one-year CDR volatilities.
|
|
245
|
-
- Clark (2003): both methods' fitted parameters, reserves, and variance
|
|
246
|
-
decompositions (to ~1e-5).
|
|
247
|
-
- Quarg & Mack (2004): the fire-portfolio example's every printed parameter
|
|
248
|
-
row and projected cell.
|
|
249
|
-
|
|
250
|
-
These published-value tests are the package's change contract: math changes
|
|
251
|
-
are wrong until they pass.
|
|
76
|
+
The six built-in formulas are basis-independent. The factory creates ten count instances plus six per amount basis (`10 + 6 × basisCount`): one basis produces 16, two produce 22. A `$250K`, primary, gross, net, or ceded calculation is represented by caller-declared amount measures and a structured `AmountBasisDefinition`; it does not need a separate capped formula. Claim-level caps use `claim-layer` derivations before aggregation. Pre-limited external values record their source/transformation instead of implying the SDK recreated an unavailable claim-level operation.
|
|
77
|
+
|
|
78
|
+
All metrics are ratio-of-sums: measures are aggregated at source-group/origin/valuation, groups are mapped and merged, then division happens once. Measure-local `missing: "unknown" | "zero"` is explicit. Exposure timing is either `origin-static` or `valuation-specific`. Calendar and ordered axes derive normalized origins, valuations, development ages, and units; input rows cannot assert a trusted age.
|
|
79
|
+
|
|
80
|
+
Compilation validates the whole graph atomically: IDs, sources, role types, compatibility groups, development semantics, derivation acyclicity, expression limits, rule operands, basis/population references, and period coordinates. Authentic compiled/prepared objects are owner-branded and frozen. Formula, calculation, definition, preparation, and result identities are deterministic FNV-1a/JCS integrity aids—not cryptographic signatures.
|
|
81
|
+
|
|
82
|
+
See the generated [formula and instance catalog](https://github.com/yerromnitsuj/actng/blob/v0.6.1/docs/reference/diagnostic-formulas.md) and [0.6 migration guide](https://github.com/yerromnitsuj/actng/blob/v0.6.1/docs/migrations/0.6-generalized-diagnostics.md).
|
|
83
|
+
|
|
84
|
+
## Main method families
|
|
85
|
+
|
|
86
|
+
- Reserving: chain ladder, Mack, Bornhuetter-Ferguson, Benktander, Cape Cod/Gluck, Expected Claims, frequency-severity, Fisher-Lange, Munich chain ladder, Clark, ODP bootstrap, and Merz-Wüthrich one-year risk.
|
|
87
|
+
- Adjustments: Berquist-Sherman, salvage/subrogation, ULAE, tails, trends, premium on-leveling, discounting, capping, severity models, and ILFs.
|
|
88
|
+
- Infrastructure: triangle algebra, seeded RNG, RFC 8785 canonical JSON, integrity tags, traditional triangle diagnostics, and generalized metric diagnostics.
|
|
89
|
+
|
|
90
|
+
Published-value tests are the numerical contract. A reserving math change is not acceptable until those fixtures still pass.
|
|
252
91
|
|
|
253
92
|
## License
|
|
254
93
|
|
|
255
|
-
Apache-2.0.
|
|
94
|
+
Apache-2.0. See LICENSE and NOTICE.
|
package/dist/capping.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capping.d.ts","sourceRoot":"","sources":["../src/capping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAIhD;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,UAAU;IACzB,6DAA6D;IAC7D,GAAG,EAAE,MAAM,CAAC;IACZ,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAMD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"capping.d.ts","sourceRoot":"","sources":["../src/capping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAIhD;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,UAAU;IACzB,6DAA6D;IAC7D,GAAG,EAAE,MAAM,CAAC;IACZ,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAA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AS,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,2BAA2B;IAC1C,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0FAA0F;IAC1F,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAyBD;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,aAAa,EAAE,EACvB,OAAO,GAAE,2BAAgC,GACxC,oBAAoB,CA4JtB"}
|
package/dist/capping.js
CHANGED
|
@@ -25,7 +25,18 @@ export function latestAccidentYear(claims, asOfDate) {
|
|
|
25
25
|
}
|
|
26
26
|
/** The effective cap for one accident year under the index. */
|
|
27
27
|
export function effectiveCap(options, year) {
|
|
28
|
-
|
|
28
|
+
if (!isNum(options.cap) ||
|
|
29
|
+
options.cap <= 0 ||
|
|
30
|
+
!isNum(options.indexRate) ||
|
|
31
|
+
options.indexRate <= -1 ||
|
|
32
|
+
!Number.isSafeInteger(options.baseYear) ||
|
|
33
|
+
!Number.isSafeInteger(year)) {
|
|
34
|
+
throw new ReservingError("BAD_CAP", "Cap, index rate, base year, and accident year must define a finite positive layer");
|
|
35
|
+
}
|
|
36
|
+
const value = options.cap * Math.pow(1 + options.indexRate, year - options.baseYear);
|
|
37
|
+
if (!Number.isFinite(value) || value <= 0)
|
|
38
|
+
throw new ReservingError("BAD_CAP", "Indexed effective cap must be finite and positive");
|
|
39
|
+
return value;
|
|
29
40
|
}
|
|
30
41
|
function resolveOptions(claims, options) {
|
|
31
42
|
if (!isNum(options.cap) || options.cap <= 0) {
|
|
@@ -41,7 +52,7 @@ function resolveOptions(claims, options) {
|
|
|
41
52
|
for (const snap of claims)
|
|
42
53
|
baseYear = Math.max(baseYear, accidentYear(snap));
|
|
43
54
|
}
|
|
44
|
-
if (!isNum(baseYear) || !Number.
|
|
55
|
+
if (!isNum(baseYear) || !Number.isSafeInteger(baseYear)) {
|
|
45
56
|
throw new ReservingError("BAD_CAP", "Could not resolve a base year for the cap index");
|
|
46
57
|
}
|
|
47
58
|
return { cap: options.cap, indexRate, baseYear };
|
|
@@ -110,6 +121,13 @@ export function claimSizeDiagnostics(claims, options = {}) {
|
|
|
110
121
|
for (const snap of latest.values()) {
|
|
111
122
|
const year = accidentYear(snap);
|
|
112
123
|
const incurred = snap.paidToDate + snap.caseReserve;
|
|
124
|
+
if (!Number.isSafeInteger(year) ||
|
|
125
|
+
year < 1 ||
|
|
126
|
+
year > 9999 ||
|
|
127
|
+
!Number.isFinite(incurred) ||
|
|
128
|
+
incurred < 0) {
|
|
129
|
+
throw new ReservingError("BAD_LOSSES", "Claim-size diagnostics require valid accident years and finite nonnegative incurred amounts");
|
|
130
|
+
}
|
|
113
131
|
let arr = byYear.get(year);
|
|
114
132
|
if (!arr)
|
|
115
133
|
byYear.set(year, (arr = []));
|
|
@@ -117,7 +135,13 @@ export function claimSizeDiagnostics(claims, options = {}) {
|
|
|
117
135
|
}
|
|
118
136
|
const years = [...byYear.keys()].sort((a, b) => a - b);
|
|
119
137
|
const indexRate = options.indexRate ?? 0;
|
|
138
|
+
if (years.length === 0)
|
|
139
|
+
throw new ReservingError("NO_CLAIMS", "No claim snapshots on or before the analysis date; cannot analyze claim sizes");
|
|
140
|
+
if (!isNum(indexRate) || indexRate <= -1)
|
|
141
|
+
throw new ReservingError("BAD_CAP", "The cap index rate must be finite and greater than -100%");
|
|
120
142
|
const baseYear = options.baseYear ?? years[years.length - 1];
|
|
143
|
+
if (!Number.isSafeInteger(baseYear))
|
|
144
|
+
throw new ReservingError("BAD_CAP", "The cap base year must be a safe integer");
|
|
121
145
|
const yearRows = years.map((year) => {
|
|
122
146
|
const sorted = [...byYear.get(year)].sort((a, b) => a - b);
|
|
123
147
|
return {
|
|
@@ -125,7 +149,10 @@ export function claimSizeDiagnostics(claims, options = {}) {
|
|
|
125
149
|
claimCount: sorted.length,
|
|
126
150
|
totalIncurred: sorted.reduce((a, v) => a + v, 0),
|
|
127
151
|
maxClaim: sorted[sorted.length - 1] ?? 0,
|
|
128
|
-
percentiles: PERCENTILES.map((p) => ({
|
|
152
|
+
percentiles: PERCENTILES.map((p) => ({
|
|
153
|
+
p,
|
|
154
|
+
value: percentile(sorted, p),
|
|
155
|
+
})),
|
|
129
156
|
};
|
|
130
157
|
});
|
|
131
158
|
// Candidate caps: provided, or derived from the pooled distribution so the
|
|
@@ -134,6 +161,13 @@ export function claimSizeDiagnostics(claims, options = {}) {
|
|
|
134
161
|
// incurred is deflated to that level before taking percentiles - otherwise
|
|
135
162
|
// a nominal anchor re-indexed forward overshoots the whole distribution
|
|
136
163
|
// and every derived candidate reads near-zero pierce.
|
|
164
|
+
for (const [label, values] of [
|
|
165
|
+
["candidateCaps", options.candidateCaps],
|
|
166
|
+
["extraCaps", options.extraCaps],
|
|
167
|
+
]) {
|
|
168
|
+
if (values?.some((value) => !isNum(value) || value <= 0))
|
|
169
|
+
throw new ReservingError("BAD_CAP", `${label} must contain only finite positive caps`);
|
|
170
|
+
}
|
|
137
171
|
let candidateCaps = options.candidateCaps;
|
|
138
172
|
if (!candidateCaps || candidateCaps.length === 0) {
|
|
139
173
|
const pooled = [...latest.values()]
|
|
@@ -163,7 +197,7 @@ export function claimSizeDiagnostics(claims, options = {}) {
|
|
|
163
197
|
let totalExcess = 0;
|
|
164
198
|
let totalIncurred = 0;
|
|
165
199
|
const cells = years.map((year) => {
|
|
166
|
-
const capY =
|
|
200
|
+
const capY = effectiveCap({ ...resolved, cap }, year);
|
|
167
201
|
const values = byYear.get(year);
|
|
168
202
|
let pierce = 0;
|
|
169
203
|
let excess = 0;
|
|
@@ -200,8 +234,7 @@ export function claimSizeDiagnostics(claims, options = {}) {
|
|
|
200
234
|
candidates,
|
|
201
235
|
baseYear,
|
|
202
236
|
indexRate,
|
|
203
|
-
nonZeroClaimCount: [...latest.values()].filter((s) => s.paidToDate + s.caseReserve > 0)
|
|
204
|
-
.length,
|
|
237
|
+
nonZeroClaimCount: [...latest.values()].filter((s) => s.paidToDate + s.caseReserve > 0).length,
|
|
205
238
|
};
|
|
206
239
|
}
|
|
207
240
|
//# sourceMappingURL=capping.js.map
|
package/dist/capping.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capping.js","sourceRoot":"","sources":["../src/capping.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AA4BlC,SAAS,YAAY,CAAC,IAAmB;IACvC,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,
|
|
1
|
+
{"version":3,"file":"capping.js","sourceRoot":"","sources":["../src/capping.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AA4BlC,SAAS,YAAY,CAAC,IAAmB;IACvC,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAuB,EACvB,QAAiB;IAEjB,MAAM,IAAI,GAAG,QAAQ,IAAI,YAAY,CAAC;IACtC,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAC;IACrB,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QAC1B,IAAI,IAAI,CAAC,cAAc,GAAG,IAAI;YAAE,SAAS;QACzC,IAAI,GAAG,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AW,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;YACjE,gBAAgB,EAAE,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;SACtE,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,KAAK,EAAE,QAAQ;QACf,UAAU;QACV,QAAQ;QACR,SAAS;QACT,iBAAiB,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAC5C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,WAAW,GAAG,CAAC,CACxC,CAAC,MAAM;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -1,53 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
incurred250: string;
|
|
10
|
-
paidPrimary: string;
|
|
11
|
-
incurredPrimary: string;
|
|
1
|
+
import { CASUALTY_FORMULA_TEMPLATES } from "./diagnosticFormulas.js";
|
|
2
|
+
import type { DiagnosticMetricInstance, DiagnosticMetricPresentation } from "./diagnosticDefinitions.js";
|
|
3
|
+
export { CASUALTY_FORMULA_TEMPLATES };
|
|
4
|
+
export interface CasualtyCountBindings {
|
|
5
|
+
readonly reported: string;
|
|
6
|
+
readonly open: string;
|
|
7
|
+
readonly closedNoPay: string;
|
|
8
|
+
readonly closedWithPay: string;
|
|
12
9
|
}
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
components?: Partial<CasualtyDiagnosticComponentKeys>;
|
|
18
|
-
frequencyScale?: number;
|
|
19
|
-
frequencyUnit?: MetricDefinition["unit"];
|
|
20
|
-
definitionVersion?: string;
|
|
21
|
-
basisLabels?: {
|
|
22
|
-
limited250?: string;
|
|
23
|
-
primary?: string;
|
|
24
|
-
counts?: string;
|
|
25
|
-
};
|
|
26
|
-
/** Per-metric display/basis overrides; formulas remain the documented preset formulas. */
|
|
27
|
-
displayOverrides?: Readonly<Record<string, MetricDisplayOverride>>;
|
|
10
|
+
export interface CasualtyAmountBinding {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly paid: string;
|
|
13
|
+
readonly incurred: string;
|
|
28
14
|
}
|
|
29
|
-
|
|
30
|
-
export
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
id?: string;
|
|
36
|
-
displayName?: string;
|
|
37
|
-
paidSourceMeasure?: string;
|
|
38
|
-
incurredSourceMeasure?: string;
|
|
39
|
-
};
|
|
40
|
-
primary?: {
|
|
41
|
-
id?: string;
|
|
42
|
-
displayName?: string;
|
|
43
|
-
indemnityPaidMeasure?: string;
|
|
44
|
-
indemnityIncurredMeasure?: string;
|
|
45
|
-
expensePaidMeasure?: string;
|
|
46
|
-
expenseIncurredMeasure?: string;
|
|
47
|
-
indemnityLimit?: number;
|
|
48
|
-
};
|
|
15
|
+
export type DiagnosticMetricPresentationOverride = Partial<DiagnosticMetricPresentation>;
|
|
16
|
+
export interface CreateCasualtyMetricInstancesInput {
|
|
17
|
+
readonly counts: CasualtyCountBindings;
|
|
18
|
+
readonly exposure: string;
|
|
19
|
+
readonly amountBindings: readonly CasualtyAmountBinding[];
|
|
20
|
+
readonly presentationOverrides?: Readonly<Record<string, DiagnosticMetricPresentationOverride>>;
|
|
49
21
|
}
|
|
50
|
-
export declare function
|
|
51
|
-
export declare const CASUALTY_AMOUNT_LAYERS: readonly AmountLayerDefinition[];
|
|
52
|
-
export {};
|
|
22
|
+
export declare function createCasualtyMetricInstances(input: CreateCasualtyMetricInstancesInput): readonly DiagnosticMetricInstance[];
|
|
53
23
|
//# sourceMappingURL=casualtyDiagnostics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"casualtyDiagnostics.d.ts","sourceRoot":"","sources":["../src/casualtyDiagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"casualtyDiagnostics.d.ts","sourceRoot":"","sources":["../src/casualtyDiagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,KAAK,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAEzG,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAEtC,MAAM,WAAW,qBAAqB;IAAG,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAAE;AACzJ,MAAM,WAAW,qBAAqB;IAAG,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE;AAChH,MAAM,MAAM,oCAAoC,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AACzF,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC1D,QAAQ,CAAC,qBAAqB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oCAAoC,CAAC,CAAC,CAAC;CACjG;AA+BD,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,kCAAkC,GAAG,SAAS,wBAAwB,EAAE,CAgD5H"}
|