Optimize stratified evidence sampling
Allocate a fixed evidence budget across finite-population strata with exact discrete Neyman allocation and quantify precision gained over proportional sampling.
What it's for
Makes evidence collection decision-aware so teams, repositories, projects, or services are measured where another sample reduces uncertainty most.
What you give it
Every tool is a pure function: it computes from what you pass it and reads nothing on its own. Inputs split into evidence you supply from your connected systems, calibration your team owns, and numerical controls that affect precision but never the result's meaning.
| Field | Type | Role | Required |
|---|---|---|---|
| confidence_level | number ≥ 0.8, ≤ 0.999 | Your calibration | Optional |
| max_detail_rows | integer ≥ 1, ≤ 10000 | Numerical control | Optional |
| strata | array of objects (5 fields) | Evidence | Yes |
| total_sample_budget | integer ≥ 1, ≤ 1000000 | Your calibration | Yes |
Each strata
record
| Field | Type | Required |
|---|---|---|
| id | string (non-empty) | Yes |
| maximum_sample_size | integer (≥ 1) | Optional |
| minimum_sample_size | integer (≥ 1) | Optional |
| outcome_standard_deviation | number (≥ 0) | Yes |
| population_size | integer (≥ 2) | Yes |
{
"strata": [
{
"id": "high-variance-services",
"outcome_standard_deviation": 5,
"population_size": 1000
},
{
"id": "stable-services",
"outcome_standard_deviation": 1,
"population_size": 1000
}
],
"total_sample_budget": 100
} 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.
{
"allocations": [
{
"at_sampling_cap": false,
"next_sample_variance_reduction": 0.00089644,
"population_size": 1000,
"population_weight": 0.5,
"sample_size": 83,
"sampling_fraction": 0.083,
"stratum_id": "high-variance-services",
"variance_contribution": 0.0690512
},
{
"at_sampling_cap": false,
"next_sample_variance_reduction": 0.00081699,
"population_size": 1000,
"population_weight": 0.5,
"sample_size": 17,
"sampling_fraction": 0.017,
"stratum_id": "stable-services",
"variance_contribution": 0.01445588
}
],
"assumptions": [
"The target is the finite-population mean and every stratum is sampled randomly without replacement using the reported allocation.",
"Outcome standard deviations are credible planning estimates on a common scale and strata are exhaustive, mutually exclusive, and fixed before sampling.",
"One sample consumes one budget slot in every stratum; unequal collection costs require a cost-constrained extension rather than reinterpretation of this result.",
"The greedy marginal allocation is exact because each stratum's finite-population variance reduction is separable and diminishing in integer sample size."
],
"decision": "variance_minimizing_sample_allocation_available",
"method": "exact_discrete_neyman_finite_population_allocation_v1",
"precision": {
"confidence_level": 0.95,
"estimated_variance": 0.08350709,
"margin_of_error": 0.566382,
"next_sample_variance_reduction": 0.00089644,
"proportional_allocation_variance": 0.1235,
"relative_precision_gain_vs_proportional": 0.3238,
"standard_error": 0.288976,
"variance_reduction_vs_proportional": 0.03999291
},
"sample": {
"allocated_samples_reconciled": 100,
"detail_rows_returned": 2, Truncated for display — the full payload is 50 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 Allocate a fixed evidence budget across finite-population strata with exact discrete Neyman allocation and quantify precision gained over proportional sampling.
- 2 Evaluate the method-specific diagnostics and gates returned by the function, then abstain unless the declared decision clears them under locally governed thresholds.
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.
- The recommendation is optimal only for its stated objective, feasible set, evidence, and solver guarantee; it is not a universal management optimum.
Minimum evidence
- strata: required and organization-defined
- total_sample_budget: required and organization-defined
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
- privacy-eligible stratum definition
- total sample budget
- minimum sample per stratum
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 20 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 a fixed evidence budget across" }
→ finds "optimize_stratified_evidence_sampling"
gitrevio_capability_describe
{ "capability_id": "optimize_stratified_evidence_sampling" }
→ returns the input schema and agent guidance shown on this page
gitrevio_capability_run
{ "capability_id": "optimize_stratified_evidence_sampling", "arguments": { ... } }
→ returns the result shown above Works in Claude Desktop, Claude Code, Cursor, Cline, Continue.dev, Goose and Aider. See the MCP server.