Drops the most recent holdout calendar diagonals (per group) from
a Triangle, returning a new Triangle of the same class with all
attributes preserved. Useful for simulating a historical analyst's
view – the same masking backtest() and detect_regime(holdout=)
apply internally.
The calendar diagonal index is built as rank(cohort) + dev - 1,
with rank() computed within group. The holdout most recent
calendar indices are dropped.
Examples
if (FALSE) { # \dontrun{
data(experience)
tri <- as_triangle(experience, groups = "coverage",
cohort = "uy_m", calendar = "cy_m",
loss = "incr_loss", premium = "incr_premium")
# Inspect what the analyst at a 6-month historical cutoff would see
tri_masked <- mask_triangle(tri, holdout = 6L)
plot_triangle(tri_masked)
# Use same masked tri to detect regime + fit
r <- detect_regime(tri_masked)
fit <- fit_ratio(tri_masked, loss_regime = r)
} # }
