2. Aggregate Overview
This chapter explains how aggregate works. It opens with a working session that introduces the DecL language and the main objects, then covers the Underwriter and its recipe library, the four computation pipelines (aggregate, reinsurance, portfolio, and P&L), the publishing pipeline that turns any of them into exhibits and charts, the automatic grid sizer, numerical artifacts that look like bugs and are not, the layout of the info string, what changed in 1.0, and how the library is tested.
- 2.1.
aggregatein Twenty Minutes- 2.1.1. Who this is for
- 2.1.2. The collective risk model, and how
aggregatecomputes it - 2.1.3. Anatomy of a DecL program
- 2.1.4. Severity: a vocabulary, not a menu
- 2.1.5. Frequency: Poisson is an opinion
- 2.1.6. Trust, but verify: the SUVA-use workflow
- 2.1.7. Limits, attachments, and increased limits
- 2.1.8. Reinsurance, gross to net
- 2.1.9. The head-to-head: FFT against Monte Carlo
- 2.1.10. Portfolios, capital, and a first price
- 2.1.11. Everything is a DataFrame
- 2.1.12. Install and next steps
- 2.2. The Underwriter and Recipes
- 2.2.1. The Underwriter
- 2.2.2. Creating objects with DecL
- 2.2.3. Comparing
build(x)andbuild.recipe(x) - 2.2.4. The recipe base
- 2.2.5. Finding things with
discover() - 2.2.6. Recipes: describe, test, audit
- 2.2.7.
programversuspprogram - 2.2.8. Loading and saving
- 2.2.9. Behind the scenes
- 2.2.10. One-page summary
- 2.3. The Aggregate Computation Pipeline
- 2.4. The Reinsurance Reporting Surface
- 2.5. The Portfolio Computation Pipeline
- 2.6. The P&L Computation Pipeline
- 2.7. The Exhibit and Chart Publishing Pipeline
- 2.8. Automatic Grid Selection (
bs,log2,x_min)- 2.8.1. The problem
- 2.8.2. Three failure modes: aliasing, off-grid loss, and a grid that cannot work
- 2.8.3. The tail report
- 2.8.4. The candidate methods
- 2.8.5. Selection and combination
- 2.8.6. Convention orientation, loss against payoff
- 2.8.7. Controls
- 2.8.8. Feasibility: when no bucket size works
- 2.8.9. Inspecting a choice
- 2.8.10. Auditing the choice afterwards with
sharpen
- 2.9. Numerical Issues
- 2.10. The
infostring - 2.11. What Changed in 1.0 vs 0.30.1
- 2.11.1. Coverage ledger
- 2.11.2. The cast of examples
- 2.11.3. New DecL elements
- Signed severity:
ssevand negativedsevatoms (a21) shift - dist: premium minus loss per claim (a22)pnl: premium minus loss, once for the book (a23; reshaped a103, a125)bivariateandcopula: joint laws of two perils (a24, renamed a80)netceded: the joint (ceded, net) law of a reinsured aggregate (a20, a24)hints{}: build settings out ofnote{}(a25)- Distortions in DecL: flat number list (a27)
- Reinsurance share syntax: the number sets the meaning (a17, a52)
- Number literals:
_digit separators (a52) approximate: method-of-moments aggregates (a47)- Statement separation: a blank line or
;(a69) - Bare unary minus on a severity (a109)
payoff/lossorientation (a102)- Labels:
as "…"(a124, a128, a132, a133) - FYI premium on the
claims/lossheads (a266) - An aggregate as a severity:
sev agg.NAME(a291) - One keyword for a partial placement:
po(a249) - A reflected severity under plain
sev(a230) tweedieround trips, and an aggregate reports its own (a231, a232)dfreq [1]: one claim is the severity (a303)ztandzmdeliver the count you asked for, and!opts out (a325)- Economics clauses on a bivariate component (a321)
approximatereaches all five families (a331)- Zero truncation is the geometric’s trials convention (a335, a336)
sev cantor: continuous with no density (a346, a347)
- Signed severity:
- 2.11.4. Better parse errors (a16)
- 2.11.5. Programs as text:
decl_writer(a53) - 2.11.6. The reporting quartet:
info/describe/stats_df/density_df- One stats surface everywhere (a3, a8, a15)
- Fixed-layout
infoandvalue_type(a54) - Exact discrete moments (a26)
- Signed-aware
describe: SD instead of CV (a23, a40, a43) - The
densityproperty andsev_density_df(a39, a21) - Reinsurance reporting (a18, a19, a41)
- Unit densities on a Portfolio (a55, a56)
- Validation: noise-aware, with honest deficit warnings (a17)
- The frequency distribution, materialized (a107, a148)
- Return-period quantile plots (a110, a235)
- Reflected (survival) readings (a269)
helpon every first-class class (a98, a101, a142, a150, a180)- The first-class-citizen contract (a170, a172)
validation_df, and the narrative pairs (a172)- Every object says what it is (a171, a174)
- Exact severity quantiles, and the OEP curve (a181)
- The approximation frames (a332 to a334, a343)
- 2.11.7. Grids, buckets and windows
- The sizing decision is inspectable (a21)
- Mean-preserving discrete bucketing:
dsev_bucket(a28) - Non-zero output windows (a51)
- The grid choice is legible (a58, a64, a65, a70)
- Guards: infinite variance and unreachable grids (a74, a87, a145)
sharpen: auditing the grid, not just trusting it (a192 to a195)- The grid sizing frame carries the two columns it exists for (a254, a267, a275)
- When no bucket size can reproduce the mean (a311, a312, a313)
- Picks refuse what they cannot honor (a272, a319)
- The grid strictly contains the window it was sized for (a348)
- 2.11.8. Tail-thickness classification (a29)
- 2.11.9. Pricing and the pentagon
- One canonical readout: the octet (a31)
- Distortions: natural parameters (a13) and the quartet
- Calibration:
distortion_dfandcalibration_df(a7, a34) - Pricing a book (a7, a17, a57)
- Stand-alone vs diversified (a33)
- The
Pentagonandprice_pentagon(a31, a43) - Free choice of capital anchor:
prob_loss_assets(a97) - Calibration on signed and payoff supports (a93, a99)
- A calibration is a receipt:
CalibrationResult(a259, a260, a261) - Stand-alone prices the parts, allocate splits the whole (a281 to a284)
- Pricing a cession:
reins_viewandreins_price_df(a223, a224, a262)
- 2.11.10. Pricing and allocation bounds
- 2.11.11. Configuration
- 2.11.12. Underwriter and persistence
- 2.11.13. Pedagogy helpers
- 2.11.14. P&L: profit and loss as a first-class object
- The ledger: Consideration, Obligation, Margin (a103, a122, a123)
- Expenses and loss-sensitive legs (a114, a115)
- Derived premium (a270)
pnlandxpnl: the net view and the walk (a136)- Acceptability:
evaluate()(a105, corrected a187, a188, a190) - Peeling a tower, layer by layer (a183, a184)
- The ledger’s index:
SideandLabel(a189, a191) - Ratios in their own frame:
economic_ratios_dfandlegs_df(a185, a186) - The accounting frames get their own names (a204, a216)
value_typeon a P&L (a248)- The margin waterfall:
waterfall_df(a253, merged a390) - Ceding commission is a contra expense (a304)
- Pricing the reinsurance:
net_combined_ratio(a306)
- 2.11.15. Bivariate aggregates
- The rename, and what the object is (a80)
- The reporting surface (a77, a85)
clash: two lines, one event (a79)- View pairs (a78)
- Massive: disk-backed bivariates (a126)
axis_support_df, and labels on a bivariate (a171)- The kappa curve, off the joint:
exeqa_df(a273, a278, a279) - Splitting a gross premium across an occurrence program (a274)
- Honest sizing on a netceded joint (a277)
- The probability accessors:
marginal,conditional,total(a328) - The bivariate frames take their first-class names (a329, a330)
- Signed lattices on
dbvsev(a345)
- 2.11.16. Reinsurance economics: stochastic ceded premium
- 2.11.17. Renewal frequency and ruin
- 2.11.18. Served documents: exhibits and charts
- Tables:
aggregate.exhibits(a200 to a207, a246, a247, a253) - The column vocabulary is a file (a286 to a288, a295, a296)
- Pictures:
aggregate.charts(a197 to a244, a252) - A document travels, and comes home (a238, a252)
- One set of decisions, two renderers (a235 to a244)
- The approximation documents (a332, a337, a344)
logtakes a direction (a342)- The
ruinchart (a341) - A program as a tower: the
structurechart (a349 to a353)
- Tables:
- 2.11.19. The recipe library
doc{{{ }}}andtags{ }(a157)- One library (a159, a161)
build.recipe()andbuild.recipes(a158, a164)- The cookbook generates itself (a165, a167)
- One library, tidied and tested (a297, a299)
- A recipe records where it was read and how it was written (a320)
- One base, many sessions:
fork,preview,RecipeNotFound(a302) - A reference keeps the referenced entry’s trailer (a318)
- Forty-three more worked examples, and a capstone chain (a327)
- 2.11.20. Under the hood
- 2.12. Testing
aggregate- 2.12.1. What is automated testing?
- 2.12.2. What is pytest?
- 2.12.3. Running the tests
- 2.12.4. Markers:
slowandxdist_group - 2.12.5. The kinds of test we have
- Unit tests, “does this one thing work?”
- Parametrized tests, “do this for every case”
- The DecL grammar suite, every statement of
decl-testers.agg - Snapshot or golden-master tests, “does the answer still match the file?”
- Feature suites, “this whole capability behaves correctly”
- Error and robustness tests, “does it fail gracefully?”
- Validation tests, “is the FFT answer trustworthy?”
- 2.12.6. Fixtures and
conftest.py - 2.12.7. Keeping
decl-testers.aggin sync - 2.12.8. Regenerating reference data
- 2.12.9. Reading a failure
- 2.12.10. Quick reference