Error Budget Experimental Design Lens
Philosophical Mode: Statistical
Primary Question: "Are error risks sized and controlled?"
Focus: Type I/II Errors, Power, Minimum Detectable Effect, Multiplicity, Sequential Monitoring
When to Use
- Need to verify statistical power before running an experiment
- Multiple comparisons are performed without a stated correction strategy
- Sequential testing or interim analysis is in use without defined stopping rules
- User invokes
/exp-lens-error-budget or /make-experiment-diag error
Critical Constraints
NEVER:
- Modify any source code files
- Do not litter the codebase with useless comments, TODO markers, or explanatory annotations — the skill output and diagram speak for themselves
- Accept default alpha=0.05 without checking whether it is appropriate for the decision context
ALWAYS:
- Enumerate every statistical test and account for its error contribution
- Distinguish per-test error rates from family-wise error rates
- Flag any sequential peeking without a formal stopping rule as a critical defect
- Evaluate whether the minimum detectable effect is practically meaningful, not just statistically chosen
- BEFORE creating any diagram, LOAD the
/mermaid skill using the Skill tool - this is MANDATORY
Analysis Workflow
Step 1: Launch Parallel Exploration Subagents
Spawn Explore subagents to investigate:
Sample Size & Power
- Find sample size calculations and power analyses
- Identify assumed effect sizes and the alpha used for sizing
- Look for: sample_size, power, n_samples, effect_size, alpha, significance
Multiple Comparisons
- Find how many statistical tests are performed in total
- Identify any multiplicity correction strategy
- Look for: test, compare, pvalue, p_value, bonferroni, fdr, holm, adjust, correct
Sequential Analysis
- Find whether data is analyzed as it arrives or at scheduled interim looks
- Identify formal stopping boundaries if any exist
- Look for: sequential, interim, early_stop, monitor, peek, accumulate, streaming
Decision Thresholds
- Find significance levels, confidence intervals, and decision rules
- Identify how raw test results are translated into accept/reject decisions
- Look for: threshold, alpha, significance, confidence, critical, reject, accept
Effect Size Context
- Find what effect sizes are practically meaningful for the decision
- Identify whether the minimum detectable effect is set by business context or convention
- Look for: effect, difference, improvement, minimum, meaningful, practical, clinical
Step 2: Build the Error Budget
Construct a complete accounting of error risks:
- What is the Type I error rate per test and family-wise across all tests?
- What is the power for the minimum practically meaningful effect?
- How many tests are performed and how is multiplicity handled (or not)?
- Is there sequential monitoring, and what are the stopping boundaries?
- Is each error tolerance justified by decision context, or is it a convention default?
Step 3: Analyze Error Allocation
CRITICAL — Analyze Error Allocation:
For every statistical test:
- Is the error rate justified by the decision context (cost of false positive vs. false negative), or is it a default (alpha=0.05)?
- Are different tests allocated different error tolerances based on their importance?
- Does the power calculation assume an effect size that is realistic and practically significant?
- Is the family-wise error rate acceptable given the number of simultaneous decisions?
Rate each test's error budget alignment:
- ALIGNED: Error tolerances match the stakes of the decision
- CONVENTIONAL: Standard values used without explicit justification
- MISALIGNED: Error tolerances are inconsistent with decision consequences
Step 4: Create Optional Decision-Flow Diagram
This lens is primarily argumentative and produces tables. An optional decision-flow diagram may be added when the test structure is non-trivial.
Direction: TB (decision flows from data through tests to conclusions)
Minimal diagram structure: Data sources → Statistical tests → Decision thresholds → Conclusions, with error rates labeled on edges
Node Styling:
cli class: Data sources
handler class: Statistical tests
detector class: Significance thresholds
output class: Decisions / conclusions
gap class: Uncorrected multiplicity or missing stopping rules
Step 5: Write Output
Write the analysis to: temp/exp-lens-error-budget/exp_diag_error_budget_{YYYY-MM-DD_HHMMSS}.md
Output Template
# Error Budget Analysis: {System / Experiment Name}
**Lens:** Error Budget (Statistical)
**Question:** Are error risks sized and controlled?
**Date:** {YYYY-MM-DD}
**Scope:** {What was analyzed}
## Error Budget
| Test | Alpha | Power | MDE | Multiplicity Correction |
|------|-------|-------|-----|------------------------|
| {test name} | {alpha} | {power %} | {minimum detectable effect} | {bonferroni / fdr / none} |
## Operating Characteristics Summary
| Metric | Value | Status |
|--------|-------|--------|
| Total tests | {N} | |
| Family-wise Type I error (uncorrected) | {value} | {OK / WARNING / CRITICAL} |
| Family-wise Type I error (corrected) | {value} | {OK / WARNING / CRITICAL} |
| Minimum power across tests | {value} | {OK / WARNING / CRITICAL} |
| Sample size adequacy | {adequate / underpowered / unknown} | |
## Sequential Monitoring Plan
{If sequential monitoring is used:}
| Look | Timing | Stopping Boundary | Alpha Spent |
|------|--------|------------------|-------------|
| {interim N} | {calendar / information fraction} | {boundary value} | {alpha} |
{If no sequential monitoring: "No interim analyses planned — full sequential peeking risk applies if data is inspected before planned end."}
## Decision Alignment Assessment
| Test | Decision Stakes | Error Tolerance Justification | Alignment |
|------|----------------|------------------------------|-----------|
| {test} | {what decision it drives} | {why this alpha/power} | {ALIGNED / CONVENTIONAL / MISALIGNED} |
## Optional Decision-Flow Diagram
```mermaid
%%{init: {'flowchart': {'nodeSpacing': 40, 'rankSpacing': 50, 'curve': 'basis'}}}%%
flowchart TB
%% CLASS DEFINITIONS %%
classDef cli fill:#1a237e,stroke:#7986cb,stroke-width:2px,color:#fff;
classDef stateNode fill:#004d40,stroke:#4db6ac,stroke-width:2px,color:#fff;
classDef handler fill:#e65100,stroke:#ffb74d,stroke-width:2px,color:#fff;
classDef phase fill:#6a1b9a,stroke:#ba68c8,stroke-width:2px,color:#fff;
classDef newComponent fill:#2e7d32,stroke:#81c784,stroke-width:2px,color:#fff;
classDef output fill:#00695c,stroke:#4db6ac,stroke-width:2px,color:#fff;
classDef detector fill:#b71c1c,stroke:#ef5350,stroke-width:2px,color:#fff;
classDef gap fill:#ff6f00,stroke:#ffa726,stroke-width:2px,color:#000;
classDef integration fill:#c62828,stroke:#ef9a9a,stroke-width:2px,color:#fff;
subgraph Data ["DATA SOURCES"]
DS1["Data Source 1<br/>━━━━━━━━━━<br/>N observations"]
DS2["Data Source 2<br/>━━━━━━━━━━<br/>N observations"]
end
subgraph Tests ["STATISTICAL TESTS"]
T1["Primary Test<br/>━━━━━━━━━━<br/>alpha={a} power={p}"]
T2["Secondary Test<br/>━━━━━━━━━━<br/>alpha={a} power={p}"]
MULTI["Multiplicity<br/>━━━━━━━━━━<br/>correction applied?"]
end
subgraph Thresholds ["DECISION THRESHOLDS"]
THR["Significance Gate<br/>━━━━━━━━━━<br/>p < alpha"]
end
subgraph Decisions ["CONCLUSIONS"]
DEC1["Accept Variant<br/>━━━━━━━━━━<br/>ship / launch"]
DEC2["Reject Variant<br/>━━━━━━━━━━<br/>do not ship"]
UNCORR["Uncorrected Tests<br/>━━━━━━━━━━<br/>inflated Type I error"]
end
DS1 -->|"alpha={a}"| T1
DS2 -->|"alpha={a}"| T2
T1 --> MULTI
T2 --> MULTI
MULTI -->|"corrected"| THR
MULTI -.->|"no correction"| UNCORR
THR -->|"p < alpha"| DEC1
THR -->|"p >= alpha"| DEC2
class DS1,DS2 cli;
class T1,T2 handler;
class MULTI,THR detector;
class DEC1,DEC2 output;
class UNCORR gap;
Color Legend:
| Color |
Category |
Description |
| Dark Blue |
Data |
Data sources feeding statistical tests |
| Orange |
Tests |
Statistical tests with error parameters |
| Red |
Thresholds |
Significance gates and decision boundaries |
| Dark Teal |
Decisions |
Conclusions reached from tests |
| Yellow |
Gaps |
Uncorrected multiplicity or missing stopping rules |
---
## Pre-Diagram Checklist
Before creating the diagram, verify:
- [ ] LOADED `/mermaid` skill using the Skill tool
- [ ] Using ONLY classDef styles from the mermaid skill (no invented colors)
- [ ] Diagram will include a color legend table
---
## Related Skills
- `/make-experiment-diag` - Parent skill for experimental lens selection
- `/mermaid` - MUST BE LOADED before creating diagram
- `/exp-lens-severity-testing` - For assessing whether tests are capable of detecting the errors they claim to test for
- `/exp-lens-variance-stability` - For diagnosing variance inflation that undermines power calculations
1---2name: exp-lens-error-budget3description: Analyze statistical error budget showing Type I/II errors, power, minimum detectable effect, multiplicity corrections, and sequential monitoring. Statistical lens answering "Are error risks sized and controlled?"4---56# Error Budget Experimental Design Lens78**Philosophical Mode:** Statistical9**Primary Question:** "Are error risks sized and controlled?"10**Focus:** Type I/II Errors, Power, Minimum Detectable Effect, Multiplicity, Sequential Monitoring1112## When to Use1314- Need to verify statistical power before running an experiment15- Multiple comparisons are performed without a stated correction strategy16- Sequential testing or interim analysis is in use without defined stopping rules17- User invokes `/exp-lens-error-budget` or `/make-experiment-diag error`1819## Critical Constraints2021**NEVER:**22- Modify any source code files23- Do not litter the codebase with useless comments, TODO markers, or explanatory annotations — the skill output and diagram speak for themselves24- Accept default alpha=0.05 without checking whether it is appropriate for the decision context2526**ALWAYS:**27- Enumerate every statistical test and account for its error contribution28- Distinguish per-test error rates from family-wise error rates29- Flag any sequential peeking without a formal stopping rule as a critical defect30- Evaluate whether the minimum detectable effect is practically meaningful, not just statistically chosen31- BEFORE creating any diagram, LOAD the `/mermaid` skill using the Skill tool - this is MANDATORY3233---3435## Analysis Workflow3637### Step 1: Launch Parallel Exploration Subagents3839Spawn Explore subagents to investigate:4041**Sample Size & Power**42- Find sample size calculations and power analyses43- Identify assumed effect sizes and the alpha used for sizing44- Look for: sample_size, power, n_samples, effect_size, alpha, significance4546**Multiple Comparisons**47- Find how many statistical tests are performed in total48- Identify any multiplicity correction strategy49- Look for: test, compare, pvalue, p_value, bonferroni, fdr, holm, adjust, correct5051**Sequential Analysis**52- Find whether data is analyzed as it arrives or at scheduled interim looks53- Identify formal stopping boundaries if any exist54- Look for: sequential, interim, early_stop, monitor, peek, accumulate, streaming5556**Decision Thresholds**57- Find significance levels, confidence intervals, and decision rules58- Identify how raw test results are translated into accept/reject decisions59- Look for: threshold, alpha, significance, confidence, critical, reject, accept6061**Effect Size Context**62- Find what effect sizes are practically meaningful for the decision63- Identify whether the minimum detectable effect is set by business context or convention64- Look for: effect, difference, improvement, minimum, meaningful, practical, clinical6566### Step 2: Build the Error Budget6768Construct a complete accounting of error risks:691. What is the Type I error rate per test and family-wise across all tests?702. What is the power for the minimum practically meaningful effect?713. How many tests are performed and how is multiplicity handled (or not)?724. Is there sequential monitoring, and what are the stopping boundaries?735. Is each error tolerance justified by decision context, or is it a convention default?7475### Step 3: Analyze Error Allocation7677**CRITICAL — Analyze Error Allocation:**78For every statistical test:79- Is the error rate justified by the decision context (cost of false positive vs. false negative), or is it a default (alpha=0.05)?80- Are different tests allocated different error tolerances based on their importance?81- Does the power calculation assume an effect size that is realistic and practically significant?82- Is the family-wise error rate acceptable given the number of simultaneous decisions?8384Rate each test's error budget alignment:85- **ALIGNED**: Error tolerances match the stakes of the decision86- **CONVENTIONAL**: Standard values used without explicit justification87- **MISALIGNED**: Error tolerances are inconsistent with decision consequences8889### Step 4: Create Optional Decision-Flow Diagram9091This lens is primarily argumentative and produces tables. An optional decision-flow diagram may be added when the test structure is non-trivial.9293**Direction:** `TB` (decision flows from data through tests to conclusions)9495**Minimal diagram structure:** Data sources → Statistical tests → Decision thresholds → Conclusions, with error rates labeled on edges9697**Node Styling:**98- `cli` class: Data sources99- `handler` class: Statistical tests100- `detector` class: Significance thresholds101- `output` class: Decisions / conclusions102- `gap` class: Uncorrected multiplicity or missing stopping rules103104### Step 5: Write Output105106Write the analysis to: `temp/exp-lens-error-budget/exp_diag_error_budget_{YYYY-MM-DD_HHMMSS}.md`107108---109110## Output Template111112```markdown113# Error Budget Analysis: {System / Experiment Name}114115**Lens:** Error Budget (Statistical)116**Question:** Are error risks sized and controlled?117**Date:** {YYYY-MM-DD}118**Scope:** {What was analyzed}119120## Error Budget121122| Test | Alpha | Power | MDE | Multiplicity Correction |123|------|-------|-------|-----|------------------------|124| {test name} | {alpha} | {power %} | {minimum detectable effect} | {bonferroni / fdr / none} |125126## Operating Characteristics Summary127128| Metric | Value | Status |129|--------|-------|--------|130| Total tests | {N} | |131| Family-wise Type I error (uncorrected) | {value} | {OK / WARNING / CRITICAL} |132| Family-wise Type I error (corrected) | {value} | {OK / WARNING / CRITICAL} |133| Minimum power across tests | {value} | {OK / WARNING / CRITICAL} |134| Sample size adequacy | {adequate / underpowered / unknown} | |135136## Sequential Monitoring Plan137138{If sequential monitoring is used:}139140| Look | Timing | Stopping Boundary | Alpha Spent |141|------|--------|------------------|-------------|142| {interim N} | {calendar / information fraction} | {boundary value} | {alpha} |143144{If no sequential monitoring: "No interim analyses planned — full sequential peeking risk applies if data is inspected before planned end."}145146## Decision Alignment Assessment147148| Test | Decision Stakes | Error Tolerance Justification | Alignment |149|------|----------------|------------------------------|-----------|150| {test} | {what decision it drives} | {why this alpha/power} | {ALIGNED / CONVENTIONAL / MISALIGNED} |151152## Optional Decision-Flow Diagram153154```mermaid155%%{init: {'flowchart': {'nodeSpacing': 40, 'rankSpacing': 50, 'curve': 'basis'}}}%%156flowchart TB157 %% CLASS DEFINITIONS %%158 classDef cli fill:#1a237e,stroke:#7986cb,stroke-width:2px,color:#fff;159 classDef stateNode fill:#004d40,stroke:#4db6ac,stroke-width:2px,color:#fff;160 classDef handler fill:#e65100,stroke:#ffb74d,stroke-width:2px,color:#fff;161 classDef phase fill:#6a1b9a,stroke:#ba68c8,stroke-width:2px,color:#fff;162 classDef newComponent fill:#2e7d32,stroke:#81c784,stroke-width:2px,color:#fff;163 classDef output fill:#00695c,stroke:#4db6ac,stroke-width:2px,color:#fff;164 classDef detector fill:#b71c1c,stroke:#ef5350,stroke-width:2px,color:#fff;165 classDef gap fill:#ff6f00,stroke:#ffa726,stroke-width:2px,color:#000;166 classDef integration fill:#c62828,stroke:#ef9a9a,stroke-width:2px,color:#fff;167168 subgraph Data ["DATA SOURCES"]169 DS1["Data Source 1<br/>━━━━━━━━━━<br/>N observations"]170 DS2["Data Source 2<br/>━━━━━━━━━━<br/>N observations"]171 end172173 subgraph Tests ["STATISTICAL TESTS"]174 T1["Primary Test<br/>━━━━━━━━━━<br/>alpha={a} power={p}"]175 T2["Secondary Test<br/>━━━━━━━━━━<br/>alpha={a} power={p}"]176 MULTI["Multiplicity<br/>━━━━━━━━━━<br/>correction applied?"]177 end178179 subgraph Thresholds ["DECISION THRESHOLDS"]180 THR["Significance Gate<br/>━━━━━━━━━━<br/>p < alpha"]181 end182183 subgraph Decisions ["CONCLUSIONS"]184 DEC1["Accept Variant<br/>━━━━━━━━━━<br/>ship / launch"]185 DEC2["Reject Variant<br/>━━━━━━━━━━<br/>do not ship"]186 UNCORR["Uncorrected Tests<br/>━━━━━━━━━━<br/>inflated Type I error"]187 end188189 DS1 -->|"alpha={a}"| T1190 DS2 -->|"alpha={a}"| T2191 T1 --> MULTI192 T2 --> MULTI193 MULTI -->|"corrected"| THR194 MULTI -.->|"no correction"| UNCORR195 THR -->|"p < alpha"| DEC1196 THR -->|"p >= alpha"| DEC2197198 class DS1,DS2 cli;199 class T1,T2 handler;200 class MULTI,THR detector;201 class DEC1,DEC2 output;202 class UNCORR gap;203```204205**Color Legend:**206| Color | Category | Description |207|-------|----------|-------------|208| Dark Blue | Data | Data sources feeding statistical tests |209| Orange | Tests | Statistical tests with error parameters |210| Red | Thresholds | Significance gates and decision boundaries |211| Dark Teal | Decisions | Conclusions reached from tests |212| Yellow | Gaps | Uncorrected multiplicity or missing stopping rules |213```214215---216217## Pre-Diagram Checklist218219Before creating the diagram, verify:220221- [ ] LOADED `/mermaid` skill using the Skill tool222- [ ] Using ONLY classDef styles from the mermaid skill (no invented colors)223- [ ] Diagram will include a color legend table224225---226227## Related Skills228229- `/make-experiment-diag` - Parent skill for experimental lens selection230- `/mermaid` - MUST BE LOADED before creating diagram231- `/exp-lens-severity-testing` - For assessing whether tests are capable of detecting the errors they claim to test for232- `/exp-lens-variance-stability` - For diagnosing variance inflation that undermines power calculations