Optimize sample size by decision value

Choose a two-arm experiment sample size by Bayesian expected value of sample information after implementation economics, sampling cost, posterior adoption and harm gates, regret, and Monte Carlo recommendation precision.

What it's for

Stops teams from buying statistical precision that cannot change an economically governed decision—and shows exactly when a larger experiment pays for itself.

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
affected_opportunities integer ≥ 1, ≤ 1000000000 Your calibration Yes
candidate_sample_sizes array of integer ≥ 1 item Evidence Yes
control_allocation_fraction number ≥ 0.05, ≤ 0.95 Your calibration Optional
harm_effect_threshold number Your calibration Optional
implementation_cost number ≥ 0 Your calibration Yes
max_detail_rows integer ≥ 1, ≤ 500 Numerical control Optional
maximum_harm_probability number ≥ 0.001, ≤ 0.5 Your calibration Optional
minimum_adoption_probability number ≥ 0.5, ≤ 0.999 Your calibration Optional
minimum_net_experiment_value number ≥ 0 Your calibration Optional
outcome_standard_deviation number > 0 Your calibration Yes
prior_effect_mean number Your calibration Yes
prior_effect_standard_deviation number > 0 Your calibration Yes
sample_cost_per_observation number ≥ 0 Your calibration Yes
seed integer ≥ 0, ≤ 4294967295 Numerical control Optional
simulation_confidence_level number ≥ 0.8, ≤ 0.999 Your calibration Optional
simulation_draws integer ≥ 1000, ≤ 1000000 Numerical control Optional
value_per_effect_unit number > 0 Your calibration Yes
Example input
{
  "affected_opportunities": 100000,
  "candidate_sample_sizes": [
    100,
    250,
    500,
    1000,
    2000
  ],
  "control_allocation_fraction": 0.5,
  "harm_effect_threshold": 0,
  "implementation_cost": 10000,
  "maximum_harm_probability": 0.1,
  "minimum_adoption_probability": 0.8,
  "minimum_net_experiment_value": 5000,
  "outcome_standard_deviation": 1,
  "prior_effect_mean": 0.01,
  "prior_effect_standard_deviation": 0.05,
  "sample_cost_per_observation": 10,
  "seed": 2026,
  "simulation_confidence_level": 0.95,
  "simulation_draws": 5000,
  "value_per_effect_unit": 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.

Example output
{
  "assumptions": [
    "The incremental effect is normally distributed under a governed prior, the two-arm estimate is unbiased with known stable outcome standard deviation, and observations satisfy the declared allocation and effective independence assumptions.",
    "Adoption value is linear over affected opportunities, implementation and sampling costs are complete, and the effect/economics transport from the experiment population and horizon to the deployment decision.",
    "The posterior policy requires both probability of positive economic value and a harm-probability guardrail; expected sample information value is relative to that governed no-sample policy, not statistical power or significance.",
    "Monte Carlo common-prior simulation is finite; recommendation requires a positive confidence lower bound, while unmodeled bias, interference, attrition, sequential peeking, implementation failure, and prior misspecification remain outside the estimate."
  ],
  "configuration": {
    "affected_opportunities": 100000,
    "candidate_sample_size_count": 5,
    "control_allocation_fraction": 0.5,
    "harm_effect_threshold": 0,
    "implementation_cost": 10000,
    "maximum_harm_probability": 0.1,
    "minimum_adoption_probability": 0.8,
    "minimum_net_experiment_value": 5000,
    "sample_cost_per_observation": 10,
    "seed": 2026,
    "simulation_confidence_level": 0.95,
    "simulation_draws": 5000,
    "value_per_effect_unit": 100
  },
  "decision": "decision_value_positive_experiment_size_supported",
  "method": "normal_normal_bayesian_expected_sample_information_value_v1",
  "sample_size_diagnostics": [
    {
      "control_observations": 1000,
      "effect_standard_error": 0.04472136,
      "expected_regret_vs_governed_perfect_information": 131976.9691,
      "experiment_cost": 20000,
      "gross_expected_sample_information_value": 115558.4047,
      "net_expected_sample_information_value": 95558.4047,
      "net_value_confidence_lower_bound": 87545.5898,
      "net_value_monte_carlo_standard_error": 4088.246,
      "posterior_effect_standard_deviation": 0.03333333,
      "probability_matching_perfect_information_decision": 0.597,
      "probability_policy_adopts": 0.1868,
      "sample_size": 2000,
      "treated_observations": 1000
    },
    {
      "control_observations": 500,
      "effect_standard_error": 0.06324555,
      "expected_regret_vs_governed_perfect_information": 182438.7832,

Truncated for display — the full payload is 115 lines.

How it works

Sequential Bayesian & bandits — Learn while deciding — update beliefs as evidence arrives and choose where the next unit of effort is worth spending.

  1. 1 Freeze a transportable normal prior, effective outcome variance, feasible two-arm sample sizes, deployment opportunities, value per effect unit, implementation and observation cost, and posterior economic and harm decision rules.
  2. 2 For each sample size, simulate true and observed effects, update the conjugate normal posterior, apply both governed posterior gates, and compare realized deployment utility with the governed no-sample policy.
  3. 3 Subtract experiment cost, quantify Monte Carlo error, regret, decision agreement, EVSI and governed EVPI, and recommend only the highest-value candidate whose net-value confidence lower bound and minimum-value gate are positive.

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

  • The likelihood or reward model, prior support, action logging, delayed outcomes, and any stationarity assumptions match the deployment process.
  • The prior is pre-data and transportable, the estimate is unbiased with declared effective variance and independence, deployment value is linear on the stated horizon, all costs are incremental, and causal design, interference, attrition, and implementation fidelity are separately valid.
  • Posterior probability and adaptive selection are model-conditional; they are not substitutes for randomized propensities or guaranteed safety.
  • This is decision-value design, not a conventional power calculation or license to peek; a positive EVSI cannot repair bias, invalid randomization, interference, outcome manipulation, or an unpriced harm threshold.

Minimum evidence

  • candidate_sample_sizes: at least 1 rows/items
  • prior_effect_mean: required and organization-defined
  • prior_effect_standard_deviation: required and organization-defined
  • outcome_standard_deviation: required and organization-defined
  • affected_opportunities: required and organization-defined
  • value_per_effect_unit: required and organization-defined
  • implementation_cost: required and organization-defined
  • sample_cost_per_observation: 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

  • transport-checked pre-experiment effect prior and effective outcome standard deviation adjusted for clustering, repeated measures, attrition, and the intended estimator
  • causal design, prior provenance, population and horizon transport, candidate sizes, allocation, value per effect unit, complete costs, adoption probability, harm threshold/probability, minimum net value, Monte Carlo precision, and seed

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": "choose a twoarm experiment sample size" }
  → finds "optimize_sample_size_by_decision_value"

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

gitrevio_capability_run
  { "capability_id": "optimize_sample_size_by_decision_value", "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 cost capitalization sensitivity

Audit whether permitted software-cost capitalization choices change reported project ROI and priority even though scenario cash NPV, downside, and economic rank are unchanged.

Statistical audit & measurement

Calculate customer concentration technology risk

Quantify the joint tail risk created when customer contribution is concentrated on shared technology, using coherent failure scenarios, non-additive dependency losses, CVaR, and overlapping component sensitivities.

Decision analysis

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 cash flow timing consistency

Audit whether economic-event and cash-settlement timing obey governed lag rules across coherent scenarios, quantify the resulting NPV distortion, reconstruct scenario liquidity paths, and separate timing exceptions from liquidity-tail exposure without treating exceptions as wrongdoing.

Statistical audit & measurement

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 delivery to cash chain integrity

Reconcile each governed milestone from delivery-ready evidence through customer acceptance, billing eligibility, net invoicing and collected cash; enforce temporal ordering, eligible-unbilled and outstanding-receivable identities, evidence separation and bounded diagnostics without treating Git activity as an accounting fact.

Statistical audit & measurement

See every tool in Finance & unit economics →

Ready to See Your Engineering work clearly?

Request a free demo