Skip to main content

gallery.reserve_rows()

One row per cohort: predicted and actual reserve at the grid endpoint.

Usage

Source

gallery.reserve_rows(
    entry,
    full_triangle,
    *,
    as_of,
    loss_field,
    premium_field="earned_premium",
    point="draw_mean",
    segment=None,
    predict_kwargs=None
)

reserve = ultimate - anchor, the anchor being the cumulative observed at as_of summed over the origins the entry was FITTED on, read from full_triangle.as_of(as_of). realized_ultimate comes from entry.realized_ultimates, which restricts itself to those same origins, so both sides of the subtraction cover the same accident years even when the triangle carries more history than the fit saw.

full_triangle may carry cohorts this entry was not fitted on: every read of it here is filtered to the cohort first, so a company’s anchor cannot pick up its neighbour’s losses and a single-cohort entry is handed only the rows it answers for.

point="draw_mean" reads the mean of entry.predict()’s total row; point="native" reads the total row of entry.point(), refuses an entry that has none, and does not call predict at all - an entry whose DRAWS refuse a cohort (Mack on a cohort whose newest accident year has a zero on the valuation diagonal) still has a point, and dropping its row leaves a company total one line short and entirely plausible. Such a row records n_draws = 0. point_source records which route was taken. predict_kwargs are handed to predict unchanged (seed, n_draws), so an entry that does not accept one raises rather than quietly ignoring it; on the native route they are refused instead, because nothing would read them.

premium is the premium field’s latest value per origin, summed over the same fitted origins; premium_field=None records NaN. Feed the rows to level_errors() with level=["company_code"] for a company board, or with the full cohort key for a company-line board.