Audit aggregate metric reversal
Detect Simpson's-paradox-style sign reversals between an executive aggregate relationship and its weighted within-stratum fixed-effect relationship, with whole-stratum bootstrap uncertainty and practical-magnitude gates.
What it's for
Prevents companywide metric rollups from implying the opposite of what happens within comparable teams, repositories, projects, services, or time cohorts.
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 |
|---|---|---|---|
| bootstrap_draws | integer ≥ 200, ≤ 20000 | Numerical control | Optional |
| confidence_level | number ≥ 0.8, ≤ 0.99 | Your calibration | Optional |
| max_detail_rows | integer ≥ 1, ≤ 500 | Numerical control | Optional |
| minimum_absolute_standardized_slope | number ≥ 0.01, ≤ 1 | Your calibration | Optional |
| minimum_reversal_probability | number ≥ 0.5, ≤ 1 | Your calibration | Optional |
| minimum_stratum_rows | integer ≥ 3, ≤ 1000 | Your calibration | Optional |
| observations | array of objects (5 fields) ≥ 50 items | Evidence | Yes |
| seed | integer | Numerical control | Optional |
Each observations
record
| Field | Type | Required |
|---|---|---|
| exposure | number | Yes |
| id | string (non-empty) | Yes |
| outcome | number | Yes |
| stratum_id | string (non-empty) | Yes |
| weight | number (> 0) | Optional |
{
"bootstrap_draws": 200,
"observations": [
{
"exposure": 0,
"id": "aggregate-reversal-0-0",
"outcome": 0,
"stratum_id": "team-0",
"weight": 1
},
{
"exposure": 1,
"id": "aggregate-reversal-0-1",
"outcome": 1,
"stratum_id": "team-0",
"weight": 2
},
{
"exposure": 2,
"id": "aggregate-reversal-0-2",
"outcome": 2,
"stratum_id": "team-0",
"weight": 3
},
{
"exposure": 3,
"id": "aggregate-reversal-0-3",
"outcome": 3,
"stratum_id": "team-0",
"weight": 1
},
{
"exposure": 4,
"id": "aggregate-reversal-0-4",
"outcome": 4,
"stratum_id": "team-0",
"weight": 2
},
{
"exposure": 5,
"id": "aggregate-reversal-0-5",
"outcome": 5,
"stratum_id": "team-0",
"weight": 3 Truncated for display — the full payload is 566 lines.
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.
{
"aggregate_relationship": {
"confidence_interval": [
-0.9623,
-0.8639
],
"raw_slope": -1.842,
"standardized_slope": -0.9398
},
"aggregation_use": "aggregate_relationship_not_decision_safe",
"decision": "aggregate_within_stratum_reversal_detected",
"interpretation": "A reversal means an executive rollup answers a different question from comparable within-stratum changes; it does not by itself identify a causal mechanism.",
"method": "weighted_fixed_effect_simpsons_reversal_cluster_bootstrap_v1",
"reversal": {
"bootstrap_probability": 1,
"minimum_absolute_standardized_slope": 0.1,
"minimum_probability": 0.9,
"observed": true
},
"sample": {
"bootstrap_draws": 200,
"rows": 80,
"strata": 8,
"total_weight": 152
},
"strata": [
{
"exposure_mean": 4.5789,
"outcome_mean": 4.5789,
"raw_slope": 1,
"rows": 10,
"standardized_slope": 1,
"stratum_id": "team-0",
"weight": 19
},
{
"exposure_mean": 9.5789,
"outcome_mean": -5.4211,
"raw_slope": 1,
"rows": 10,
"standardized_slope": 1,
"stratum_id": "team-1",
"weight": 19
}, Truncated for display — the full payload is 108 lines.
How it works
Statistical audit & measurement — Check whether a number is fit to decide on: coverage, timing, reconciliation, and the gaps a dashboard hides.
- 1 Fit the population-weighted aggregate exposure/outcome slope at the declared observation grain and standardize it for comparability.
- 2 Remove weighted stratum means from exposure and outcome, then fit the weighted fixed-effect slope using only within-stratum variation.
- 3 Resample entire strata and then rows within each sampled stratum so uncertainty preserves the clustered data-generating structure.
- 4 Flag a reversal only when the slopes have opposite signs, both clear the practical standardized-magnitude threshold, and the bootstrap reversal probability clears its governed threshold.
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
- Metric definitions, weights, aggregate grain, sampling, missingness, dependence, and comparison windows correspond to the management claim being audited.
- The declared strata are comparable contexts, contain sufficient exposure variation, and are not created after inspecting the desired result.
- Observation weights represent the intended executive population rather than convenience or duplicated activity volume.
- Association, instability, or measurement quality is not a causal effect and must not be converted directly into an individual employment decision.
- A reversal proves that aggregate and within-stratum summaries answer different questions; it does not establish causality or identify why the reversal exists.
Minimum evidence
- observations: at least 50 rows/items
How to validate it
Validate on future periods or held-out aggregate units, compare with a simple baseline, and require stability across plausible metric definitions and decision thresholds.
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
- one comparable observation per declared stratum-period grain
- complete strata with enough within-stratum variation
- exposure/outcome definitions and directions
- stratification variable and minimum rows per stratum
- practical standardized relationship and reversal-probability thresholds
Calibration workflow
- 1 Define the management decision, target outcome, aggregate unit, privacy boundary, cadence, and prediction/intervention horizon for this organization.
- 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 Estimate statistical parameters on training history, but obtain costs, utilities, risk tolerance, practical-effect thresholds, capacity, and policy constraints from accountable decision owners.
- 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 Deploy only if the returned decision clears evidence, overlap, calibration, robustness, and guardrail checks; warning, unsupported, schema-gap, and fallback decisions are abstentions.
- 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": "detect simpsonsparadoxstyle sign reversals between an" }
→ finds "audit_aggregate_metric_reversal"
gitrevio_capability_describe
{ "capability_id": "audit_aggregate_metric_reversal" }
→ returns the input schema and agent guidance shown on this page
gitrevio_capability_run
{ "capability_id": "audit_aggregate_metric_reversal", "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
Analyze deep uncertainty minimax regret
Apply Savage minimax regret when scenario probabilities are not defensible, compare maximin and equal-weight choices, and use PRIM-style iterative peeling to discover compact context boxes where the robust choice remains vulnerable.
Optimize technical debt paydown portfolio
Choose a dependency- and exclusion-safe technical-debt portfolio under capacity and cash budgets by discounting compounding recurring drag, failure exposure, remediation effectiveness, risk reduction, and engineering opportunity cost.
Audit informative metric missingness
Audit whether aggregate metric availability is associated with a governed outcome using permutation inference, bootstrap intervals, practical effect gates, and false-discovery control.
Audit joint metric dependency drift
Detect changes in cross-metric dependence with empirical-copula ranks, random-feature permutation inference, sliced Wasserstein magnitude, and FDR-controlled pair diagnostics.
Audit multivariate metric drift
Detect material distribution shifts with reference-fixed quantile bins, PSI, Jensen-Shannon divergence, standardized Wasserstein distance, permutation tests, and FDR control.
Audit point in time model integrity
Gate an analytical or AI model on point-in-time correctness by auditing actual feature availability, snapshot creation, target-window ordering, outcome resolution, source-record reuse, and embargoed train/calibration/test boundaries, with row and feature diagnostics rather than a generic leakage warning.