gaspatchio-model-scenarios

Runs scenario analysis, parameter shocks, and sensitivity sweeps on gaspatchio actuarial models.

4|Updated Jul 4, 2026
One-click install
npx skills add https://github.com/gaspatchio/gaspatchio --skill gaspatchio-model-scenarios-gaspatchio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gaspatchio-model-scenarios
Source: https://github.com/gaspatchio/gaspatchio/tree/main/skills/gaspatchio-model-scenarios
Command: npx skills add https://github.com/gaspatchio/gaspatchio --skill gaspatchio-model-scenarios-gaspatchio

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Actuaries need to stress-test projection models against mortality, lapse, interest rate, and expense shocks without rewriting the model each time, while keeping a reproducible audit trail for governance. ## Core Features & Use Cases - Typed scenario plans: Build a ScenarioRun with shock recipes (MultiplicativeShock, AdditiveShock, FilteredShock, TimeConditionalShock, PipelineShock) and mergeable aggregators, keeping model.py unchanged via the assumptions_override contract. - Progressive analysis levels: Interest rate comparisons, parameter shocks, conditional shocks, 1D/2D sensitivity sweeps, and named regulatory stress scenarios. - Audit and reporting: Every run produces a plan SHA, a JSON audit sidecar, and a report/report.md with results tables, Altair charts, and key findings. - Use Case: Given a working gaspatchio projection model, run a Solvency II lapse stress (×1.5 clipped at 1.0) plus a mortality +20% shock, then produce a tornado chart and a report with the plan SHA pinned for regulatory evidence. ## Quick Start Ask the assistant to run a mortality up 20% and lapse down 20% scenario analysis on your gaspatchio model and produce the report with charts and audit chain.

Frequently Asked Questions about gaspatchio-model-scenarios

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run scenario analysis on a gaspatchio model?

Build a ScenarioRun with a shocks dict, base_tables, and aggregations, then call plan.run(af, model_fn, audit=True). Keep model.py unchanged and put all scenario logic in run_scenarios.py, bridging shocked tables through the model_fn wrapper's assumptions_override.

How do I apply mortality or lapse shocks without modifying my model?

Declare shocks such as MultiplicativeShock(factor=1.2, table="mortality_select") in the ScenarioRun plan. The plan stacks base tables with a scenario_id dimension and applies shocks per batch, so the model reads shocked values through a normal Table.lookup call.

Can I run sensitivity sweeps over two parameters in gaspatchio?

Yes, build the shocks dict with a comprehension over both parameter grids, for example mortality × lapse multipliers, and hand it to ScenarioRun. Pivot the resulting aggregation DataFrame into a heatmap to visualize the 2D interaction.

Why does my model fail when run standalone after adding scenario lookups?

Scenario-stacked tables require scenario_id as a lookup kwarg, but standalone runs use unstacked tables. Use the _maybe_scenario guard to pass scenario_id only when the table actually has that dimension, keeping the model debuggable under gspio run-single-policy.

What audit artifacts does a gaspatchio scenario run produce?

plan.source_sha() gives a content hash over shocks, base tables, aggregations, and seed, plan.to_yaml() round-trips flat shock recipes, and plan.run(audit=True) writes a JSON audit sidecar. The report must pin the SHA and reference the sidecar path.

When should I use with_scenarios instead of ScenarioRun?

Use with_scenarios only for quick interactive exploration or pure interest-rate cross-joins. It provides no plan SHA, audit sidecar, or YAML round-trip, so promote the analysis to ScenarioRun once it settles.