Fit anchor regression shift robust model
Fit anchor regression across declared operating environments, penalizing residual variation predictable from environment anchors over a governed gamma path; choose robustness strength only on held-out worst-environment RMSE; and expose average fit, environment bias, coefficients, and leave-one-environment stability without claiming generic or causal invariance.
What it's for
Adds a defensible answer to 'will this model survive the next operating regime?': Gitrevio explicitly trades average fit for held-out worst-environment robustness and shows which coefficients remain fragile when one environment disappears.
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 |
|---|---|---|---|
| feature_names | array of string ≥ 1 item | Evidence | Yes |
| gamma_values | array of number ≥ 2 items | Evidence | Yes |
| max_detail_rows | integer ≥ 1, ≤ 500 | Numerical control | Optional |
| minimum_worst_environment_improvement | number ≥ 0 | Your calibration | Optional |
| observations | array of objects (5 fields) ≥ 120 items | Evidence | Yes |
| ridge_penalty | number ≥ 0, ≤ 1000000 | Your calibration | Optional |
Each observations
record
| Field | Type | Required |
|---|---|---|
| environment_id | string (non-empty) | Yes |
| features | object | Yes |
| id | string (non-empty) | Yes |
| outcome | number | Yes |
| split | one of "train", "test" | Yes |
{
"feature_names": [
"stable_signal",
"environment_proxy"
],
"gamma_values": [
1,
5,
20
],
"observations": [
{
"environment_id": "environment-0",
"features": {
"environment_proxy": 0,
"stable_signal": 0
},
"id": "anchor-0-train-0",
"outcome": 1,
"split": "train"
},
{
"environment_id": "environment-0",
"features": {
"environment_proxy": -0.12241743810962724,
"stable_signal": 0.3271946967961522
},
"id": "anchor-0-train-1",
"outcome": 1.5319719554826772,
"split": "train"
},
{
"environment_id": "environment-0",
"features": {
"environment_proxy": -0.45969769413186023,
"stable_signal": 0.618369803069737
},
"id": "anchor-0-train-2",
"outcome": 1.7770419120076137,
"split": "train"
},
{
"environment_id": "environment-0",
"features": { Truncated for display — the full payload is 1213 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.
{
"assumptions": [
"Environment anchors represent meaningful interventions or operating shifts, train/test rows are chronologically or prospectively separated within every environment, and test environments were not used to choose features.",
"The linear conditional relation is adequate after residual diagnostics, relevant shift directions lie in the span of the anchors, and environment support is sufficient for worst-environment validation.",
"Gamma controls robustness to anchor-aligned shifts rather than generic adversarial perturbations; coefficient stability under leaving out one environment is diagnostic, not proof of invariance."
],
"candidate_strengths": [
{
"environment_metrics": [
{
"environment_id": "environment-0",
"mean_residual": 1.128,
"rmse": 1.1953,
"rows": 20
},
{
"environment_id": "environment-1",
"mean_residual": 0,
"rmse": 0.3955,
"rows": 20
},
{
"environment_id": "environment-2",
"mean_residual": -1.128,
"rmse": 1.1953,
"rows": 20
}
],
"gamma": 1,
"held_out_average_rmse": 1.0023,
"held_out_worst_environment_rmse": 1.1953,
"maximum_absolute_environment_mean_residual": 1.128
},
{
"environment_metrics": [
{
"environment_id": "environment-0",
"mean_residual": 0.3226,
"rmse": 0.6512,
"rows": 20
},
{
"environment_id": "environment-1",
"mean_residual": 0, Truncated for display — the full payload is 147 lines.
How it works
Causal inference & experiment design — Separate what a change caused from what merely moved alongside it.
- 1 Freeze the feature set and environment vocabulary, require train and later/prospective test support inside every environment, and standardize features using training data only.
- 2 For every gamma including the ordinary ridge baseline at one, solve the closed-form anchor objective: prediction loss plus gamma-minus-one times residual variation projected onto the training environment indicators.
- 3 Evaluate every fitted model only on held-out rows by environment, then select the gamma minimizing worst-environment RMSE with average RMSE and smaller gamma as tie-breakers; claim a gain only when it clears the governed practical improvement.
- 4 Transform coefficients to original units and refit while leaving out each training environment to expose coefficient fragility; retain environment-level residual bias because average accuracy can conceal systematic shift failure.
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
- Assignment or adoption timing, interference policy, overlap, attrition, and outcome availability match the estimand encoded by the method.
- Environment anchors represent meaningful interventions or operating shifts, relevant future shift directions lie in their span, and train/test separation within every environment is chronological or prospective.
- A linear outcome relation is adequate after residual diagnostics, environment support is sufficient, and features were chosen without consulting held-out environment performance.
- A causal label is warranted only when design and diagnostic requirements pass; otherwise treat the result as descriptive or abstain.
- Held-out anchor robustness applies to shifts represented by the declared environments; it is not protection against arbitrary distribution change, omitted variables, nonlinear failure, or a new causal regime.
- A stable coefficient is not automatically a causal effect. Causal interpretation additionally requires valid anchor intervention assumptions, graph knowledge, and exclusion of direct anchor-to-outcome pathways.
Minimum evidence
- observations: at least 120 rows/items
- feature_names: at least 1 rows/items
- gamma_values: at least 2 rows/items
How to validate it
Preserve the assignment/adoption design and validate overlap, pre-period or placebo diagnostics, attrition, interference policy, and cluster-level uncertainty; never tune on the estimated effect.
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 fixed-grain feature/outcome row with a chronological train/test assignment inside every environment
- training-only feature scaling and held-out environment-support diagnostics
- environment meaning, feature vocabulary, outcome, observation grain, time split, gamma path, ridge stabilization, practical worst-environment gain, and acceptable coefficient instability
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": "fit anchor regression across declared operating" }
→ finds "fit_anchor_regression_shift_robust_model"
gitrevio_capability_describe
{ "capability_id": "fit_anchor_regression_shift_robust_model" }
→ returns the input schema and agent guidance shown on this page
gitrevio_capability_run
{ "capability_id": "fit_anchor_regression_shift_robust_model", "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 selective label partial identification
Partially identify event risk, calibration gap, and Brier score when a policy selectively reveals outcomes: retain missing labels, model observed-versus-missing event odds within each decision stratum under a governed sensitivity ratio, propagate Beta posterior uncertainty, expose unsupported strata and label coverage, and fail closed on wide bounds or undocumented decision rules.
Forecast change adoption bass diffusion
Forecast aggregate organizational change or tool adoption with a Bayesian Bass diffusion model learned from reconciled historical cohorts, jointly estimating spontaneous innovation and imitation, simulating posterior uptake under per-cohort enablement capacity, pricing enabled value, exposing grid-boundary misspecification, and gating a target adoption probability.
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.
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.
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.