Estimate risk contribution shapley

Allocate portfolio CVaR loss across initiatives, companies, services, or risk factors with exact subset Shapley values or disclosed sampled permutations while preserving diversification and hedge contributions.

What it's for

Explains exactly which initiatives or portfolio companies contribute to severe downside and which diversify it—without equating standalone risk with portfolio risk.

What you give it

Inputs split into evidence read from your connected systems, calibration your team owns, and numerical controls that affect precision but never the result's meaning.

Field Type Role Required
components array of objects (2 fields) ≥ 2 items Evidence Yes
exact_component_limit integer ≥ 1, ≤ 20 Your calibration Optional
max_detail_rows integer ≥ 1, ≤ 500 Numerical control Optional
permutation_draws integer ≥ 200, ≤ 100000 Numerical control Optional
scenario_probabilities array of number ≥ 2 items Evidence Yes
seed integer Numerical control Optional
tail_probability number ≥ 0.001, ≤ 0.5 Your calibration Optional

Each components record

Field Type Required
id string (non-empty) Yes
scenario_losses array of number (≥ 2 items) Yes
Example input
{
  "components": [
    {
      "id": "growth",
      "scenario_losses": [
        500,
        100,
        -100,
        -250
      ]
    },
    {
      "id": "platform",
      "scenario_losses": [
        100,
        50,
        0,
        -50
      ]
    },
    {
      "id": "resilience",
      "scenario_losses": [
        -200,
        -50,
        20,
        50
      ]
    }
  ],
  "scenario_probabilities": [
    0.1,
    0.2,
    0.3,
    0.4
  ],
  "tail_probability": 0.1
}

What you get back

This is the actual output of running the example above — computed by the same function the platform calls, not an illustration.

Example output
{
  "assumptions": [
    "Component losses share aligned joint scenarios and one finance-owned loss unit, horizon, and probability model.",
    "Shapley contribution allocates modeled portfolio CVaR fairly across coalition orderings; it is not causal blame.",
    "Negative contributions can be legitimate hedges and must not be clipped or treated as data errors automatically."
  ],
  "component_diagnostics": [
    {
      "component_id": "growth",
      "diversification_effect": 81.6667,
      "monte_carlo_standard_error": 0,
      "shapley_cvar_contribution": 418.3333,
      "share_of_portfolio_cvar": 1.0458,
      "standalone_cvar_loss": 500
    },
    {
      "component_id": "platform",
      "diversification_effect": 21.6667,
      "monte_carlo_standard_error": 0,
      "shapley_cvar_contribution": 78.3333,
      "share_of_portfolio_cvar": 0.1958,
      "standalone_cvar_loss": 100
    },
    {
      "component_id": "resilience",
      "diversification_effect": 146.6667,
      "monte_carlo_standard_error": 0,
      "shapley_cvar_contribution": -96.6667,
      "share_of_portfolio_cvar": -0.2417,
      "standalone_cvar_loss": 50
    }
  ],
  "decision": "portfolio_tail_risk_contributions_allocated",
  "method": "cvar_risk_contribution_shapley_v1",
  "solver_diagnostics": {
    "distinct_subset_risk_evaluations": 8,
    "exact": true,
    "permutation_draws": 0,
    "solver": "exact_subset_shapley",
    "tail_probability": 0.1
  },
  "summary": {
    "component_count": 3,
    "efficiency_absolute_error": 0,

Truncated for display — the full payload is 53 lines.

How it works

Constrained optimization — Pick the best feasible option under real limits — budget, headcount, dependencies, capacity — rather than ranking a list and hoping it fits.

  1. 1 Freeze components, finance loss unit/horizon, aligned joint loss scenarios, probabilities, and tail probability.
  2. 2 Evaluate coalition CVaR and average every component's marginal tail-risk contribution across all subset orderings exactly within the boundary or sampled permutations beyond it.
  3. 3 Verify Shapley efficiency against total portfolio CVaR, compare standalone risk with allocated contribution, and retain negative hedge contributions rather than clipping them.

Before you trust it

Every tool in the catalog ships with the conditions under which its answer is meaningful — and the conditions under which it should abstain instead of guessing.

Assumptions & guardrails

  • Objectives use commensurable locally governed value units, constraints reflect real feasibility, and uncertainty covers plausible adverse inputs.
  • Every component uses the same joint scenario column; marginal scenario sorting would destroy diversification and invalidate attribution.
  • The recommendation is optimal only for its stated objective, feasible set, evidence, and solver guarantee; it is not a universal management optimum.
  • Shapley allocates modeled portfolio risk fairly across coalition orderings; it is not causal blame, personnel performance, or proof of controllability.

Minimum evidence

  • components: at least 2 rows/items
  • scenario_probabilities: at least 2 rows/items

How to validate it

Backtest the chosen action against simple feasible baselines on held-out scenarios, sweep costs/constraints/risk tolerance, and require constraint feasibility under adverse inputs.

Calibrating it to your org

Same for everyone

The mathematical kernel, validation rules, method version, and JSON output semantics are organization-independent; no tenant-trained coefficients or company benchmark is embedded in the function.

Specific to you

  • component-by-scenario loss matrix retaining common scenario column identity
  • component boundary, loss definition, currency, horizon, probabilities, tail probability, exact boundary, and sampling precision

Calibration workflow

  1. 1 Define the management decision, target outcome, aggregate unit, privacy boundary, cadence, and prediction/intervention horizon for this organization.
  2. 2 Build a tenant-scoped historical cohort using only information available before each prediction or decision; preserve zero periods, censoring, assignment probabilities, and unresolved outcomes when the method requires them.
  3. 3 Estimate statistical parameters on training history, but obtain costs, utilities, risk tolerance, practical-effect thresholds, capacity, and policy constraints from accountable decision owners.
  4. 4 Validate on later time windows or held-out aggregate units at the deployment grain, against a simple baseline and the function-specific validation strategy.
  5. 5 Deploy only if the returned decision clears evidence, overlap, calibration, robustness, and guardrail checks; warning, unsupported, schema-gap, and fallback decisions are abstentions.
  6. 6 Monitor realized outcomes, data drift, coverage, and decision regret; recalibrate at a governed cadence or after a detected regime/definition change, never merely because a stakeholder dislikes the result.

Call it from your AI

You don't wire up 388 tools in your MCP client. The GitRevio MCP server exposes 18 tools, three of which let an agent search the catalog, read a tool's schema, and run it — so the assistant finds this one on its own.

gitrevio_capabilities_search
  { "q": "allocate portfolio cvar loss across initiatives" }
  → finds "estimate_risk_contribution_shapley"

gitrevio_capability_describe
  { "capability_id": "estimate_risk_contribution_shapley" }
  → returns the input schema and agent guidance shown on this page

gitrevio_capability_run
  { "capability_id": "estimate_risk_contribution_shapley", "arguments": { ... } }
  → returns the result shown above

Works in Claude Desktop, Claude Code, Cursor, Cline, Continue.dev, Goose and Aider. See the MCP server.

Related tools

Audit benefit double counting

Reconcile business-case benefit claims to unique economic source pools and allocation fractions, exposing overallocated sources and claim-level mismatches before portfolio value is aggregated.

Constrained optimization

Audit cost allocation consistency

Audit whether shared engineering, platform, cloud, vendor, or operating cost pools reconcile to source totals and follow their declared pro-rata allocation bases at every target.

Statistical audit & measurement

Audit ROI denominator integrity

Reconcile each claimed ROI investment denominator with evidenced cost entries, required categories, inclusion fractions, and shared evidence identity, then recompute ROI before a business case reaches prioritization.

Statistical audit & measurement

Build reverse stress scenarios

Solve the minimum standardized bounded combination of adverse driver shocks needed to breach a governed operating or financial threshold, with driver contributions, binding bounds, and single-driver break points.

Decision analysis

Calculate capital efficiency frontier

Construct a monotone concave capital-to-realized-value envelope, estimate each initiative or portfolio company's relative capital efficiency and value gap, and expose diminishing frontier returns without arbitrary weights.

Constrained optimization

Calculate engineering unit economics

Calculate uncertainty-aware engineering cost and net incremental contribution per adopted business outcome across aligned scenarios, including quality/run cost and downside-margin probability.

Decision analysis

See every tool in Finance & unit economics →

Ready to See Your Engineering work clearly?

Request a free demo