Experiment Design
Interview-driven design workflow producing design documents, power analysis scripts, and pre-analysis plans.
Modes
| Mode |
What it produces |
Entry point |
| Power |
Power analysis script + sample size table |
"How many participants do I need?" |
| Design |
Full design document (hypotheses, conditions, measures, randomization) |
"Design my experiment" |
| PAP |
Pre-analysis plan (AEA/OSF/EGAP format) |
"Write a PAP" |
| Survey |
Structured survey specification from natural language or QSF |
"Build a survey" / "Parse my Qualtrics" |
Default: Design. If user provides a .qsf file, auto-select Survey mode.
When to Use
- Designing a new experiment or survey
- Calculating required sample sizes
- Writing or auditing a pre-analysis plan
- Parsing a Qualtrics
.qsf file to understand its structure
- Building a survey specification from a natural language description
When NOT to Use
- Running the analysis →
data-analysis
- Auditing identification strategy for observational studies →
causal-design
- Generating synthetic test data →
synthetic-data
Shared References
- Method probing questions:
shared/method-probing-questions.md — ask before designing (Experiments/RCTs, Survey sections)
- Validation tiers:
shared/validation-tiers.md — tier determines required power and pre-registration
- Escalation protocol:
shared/escalation-protocol.md — escalate when design has validity threats
- Engagement-stratified sampling:
shared/engagement-stratified-sampling.md — stratify social media samples by engagement
- Inter-coder reliability:
shared/intercoder-reliability.md — reliability planning for content analysis designs
Mode: Power
Read references/power-analysis-recipes.md for language-specific code patterns.
Workflow
- Interview — ask for:
- Primary outcome variable and expected effect size (or domain norms)
- Design type (between-subjects, within-subjects, factorial, cluster-randomized)
- Number of conditions/groups
- Significance level (default: 0.05) and desired power (default: 0.80)
- Any clustering or stratification
- Generate script — R (
DeclareDesign/pwr) or Python (statsmodels.stats.power)
- Execute and report — produce a sample size table showing N for power = {0.80, 0.90, 0.95}
- Write to project — save script to
code/power_analysis.R (or .py), results to output/power_analysis_results.md
HPC escalation: If the power analysis uses Monte Carlo simulation (e.g., DeclareDesign with >10k replications, or a multi-design sweep), move execution to [HPC cluster] — drop the simulation script into hpc/ with templates/slurm/array.sbatch (array over seeds/designs). The SHA-logging snippet in the template pins results to the DGP version. See docs/guides/hpc.md.
Effect Size Guidance
If the user doesn't know the expected effect size, guide them:
| Source |
How to use |
| Prior literature |
"What did similar studies find?" |
| Pilot data |
Calculate from pilot descriptives |
| SESOI |
"What's the smallest effect worth detecting?" |
| Domain norms |
Cohen's benchmarks as absolute last resort (small=0.2, medium=0.5, large=0.8 for d) |
Never default to Cohen's benchmarks without acknowledging they are arbitrary.
Mode: Design
Workflow
- Research question interview — structured questions:
- What is the causal question?
- What is the treatment / intervention?
- What is the primary outcome? Secondary outcomes?
- What is the target population?
- What is the assignment mechanism? (random, stratified, clustered, matched)
- Design specification — produce a structured document covering:
- Hypotheses (directional, with expected signs)
- Conditions (treatment arms, control)
- Randomization procedure
- Outcome measures and scales
- Sample and recruitment strategy
- Timeline
- Identification check — state the estimand, identifying assumptions, and potential threats
- Write design document — save to
docs/experiment-design.md or project-appropriate location
- Lock the design — record in
MEMORY.md Estimand Registry (if project has one) or flag for the user to lock before analysis
This design document is what data-analysis Phase 3 checks for before allowing estimation.
Mode: PAP
Read references/pap-template.md for the full template structure.
Workflow
- Check for existing design — look for design document in
docs/, log/plans/, or .context/
- If no design exists — run Design mode first, then continue
- Generate PAP — structured pre-analysis plan following AEA/OSF/EGAP conventions:
- Study information (title, authors, IRB, registration)
- Design overview (hypotheses, conditions, randomization, sample)
- Data collection (instruments, timing, blinding)
- Analysis plan (main specification, inference, multiple testing corrections)
- Robustness and sensitivity analyses
- Power analysis (reference or embed results from Power mode)
- Output — save to
docs/pre-analysis-plan.md (or .tex if user prefers LaTeX)
- Registration prompt — remind user to register at AEA RCT Registry, OSF, or EGAP
Mode: Survey
Survey mode is a first-class capability with two entry points: QSF parsing and natural language construction.
Entry Point A: QSF Parsing
When user provides a Qualtrics .qsf file:
- Parse the JSON — extract survey flow, blocks, questions, embedded data, skip logic
- Map question types — read
references/qsf-parsing-guide.md for type mapping:
- Matrix, Likert, slider, numeric, constant sum, rank order, best-worst scaling
- Text entry (single-line, multi-line, essay)
- Multiple choice (single answer, multiple answer)
- Detect design elements:
- Factorial conditions from randomizer blocks and embedded data
- Attention checks and comprehension checks
- Known validated scales (read
references/known-scales-registry.md)
- Skip/display logic and branching
- Produce structured summary — questions, conditions, scales, logic flow, warnings
- Flag issues — missing attention checks, unbalanced conditions, potential order effects
Entry Point B: Natural Language Construction
When user describes an experiment in natural language:
- Parse the design — extract factorial structure from text
- Example: "3 (Source: AI vs Human vs None) x 2 (Product: Hedonic vs Utilitarian)" → 3x2 between-subjects
- Interview for details:
- What DVs to measure? (recommend appropriate scale types)
- What manipulation checks?
- What attention/comprehension checks?
- Demographics and control variables?
- Generate survey specification — structured document with:
- Survey flow (consent → demographics → manipulation → DVs → manipulation check → debrief)
- Question text and response options for each item
- Condition assignments and randomization logic
- Attention check placement (read
references/survey-design-checklist.md)
- Scale recommendations — read
references/known-scales-registry.md for validated scales matching the constructs
Survey Quality Checks
Read references/survey-design-checklist.md for the full checklist. Key checks:
- Attention checks: At least 1 per 5 minutes of survey length. Calibrated pass rates (85-95%). See Krosnick (1991), Meade & Craig (2012).
- Response style mitigation: Flag scales vulnerable to acquiescence bias. Recommend reverse-coding for scales with 4+ items in the same direction.
- Scale quality: Semantic type detection (satisfaction, trust, intention, risk). Reverse-coded item flagging. Well-known scale recognition.
- Order effects: Randomize question order within blocks where appropriate. Flag potential priming from early questions.
Cross-References
| Resource |
When read |
references/power-analysis-recipes.md |
Power mode |
references/pap-template.md |
PAP mode |
references/survey-design-checklist.md |
Survey mode (quality checks) |
references/identification-strategies.md |
Design mode (identification check) |
references/qsf-parsing-guide.md |
Survey mode (QSF parsing) |
references/known-scales-registry.md |
Survey mode (scale recognition) |
design-before-results rule |
Design + PAP modes produce the locked design |
data-analysis skill |
Consumes the design document |
causal-design skill |
For observational identification (not experiments) |
synthetic-data skill |
For generating pilot data |
1---2name: experiment-design3description: Design empirical studies through power analysis, pre-analysis planning, QSF parsing, and survey architecture. Use when specifying sampling, measurement, treatment, or analysis before data collection. Not for causal identification alone; use $causal-design.4---56# Experiment Design78> Interview-driven design workflow producing design documents, power analysis scripts, and pre-analysis plans.910## Modes1112| Mode | What it produces | Entry point |13|------|-----------------|-------------|14| **Power** | Power analysis script + sample size table | "How many participants do I need?" |15| **Design** | Full design document (hypotheses, conditions, measures, randomization) | "Design my experiment" |16| **PAP** | Pre-analysis plan (AEA/OSF/EGAP format) | "Write a PAP" |17| **Survey** | Structured survey specification from natural language or QSF | "Build a survey" / "Parse my Qualtrics" |1819Default: **Design**. If user provides a `.qsf` file, auto-select Survey mode.2021## When to Use2223- Designing a new experiment or survey24- Calculating required sample sizes25- Writing or auditing a pre-analysis plan26- Parsing a Qualtrics `.qsf` file to understand its structure27- Building a survey specification from a natural language description2829## When NOT to Use3031- Running the analysis → `data-analysis`32- Auditing identification strategy for observational studies → `causal-design`33- Generating synthetic test data → `synthetic-data`3435## Shared References3637- Method probing questions: `shared/method-probing-questions.md` — ask before designing (Experiments/RCTs, Survey sections)38- Validation tiers: `shared/validation-tiers.md` — tier determines required power and pre-registration39- Escalation protocol: `shared/escalation-protocol.md` — escalate when design has validity threats40- Engagement-stratified sampling: `shared/engagement-stratified-sampling.md` — stratify social media samples by engagement41- Inter-coder reliability: `shared/intercoder-reliability.md` — reliability planning for content analysis designs4243---4445## Mode: Power4647Read `references/power-analysis-recipes.md` for language-specific code patterns.4849### Workflow50511. **Interview** — ask for:52 - Primary outcome variable and expected effect size (or domain norms)53 - Design type (between-subjects, within-subjects, factorial, cluster-randomized)54 - Number of conditions/groups55 - Significance level (default: 0.05) and desired power (default: 0.80)56 - Any clustering or stratification572. **Generate script** — R (`DeclareDesign`/`pwr`) or Python (`statsmodels.stats.power`)583. **Execute and report** — produce a sample size table showing N for power = {0.80, 0.90, 0.95}594. **Write to project** — save script to `code/power_analysis.R` (or `.py`), results to `output/power_analysis_results.md`6061**HPC escalation:** If the power analysis uses Monte Carlo simulation (e.g., `DeclareDesign` with >10k replications, or a multi-design sweep), move execution to [HPC cluster] — drop the simulation script into `hpc/` with `templates/slurm/array.sbatch` (array over seeds/designs). The SHA-logging snippet in the template pins results to the DGP version. See [`docs/guides/hpc.md`](../../docs/guides/hpc.md).6263### Effect Size Guidance6465If the user doesn't know the expected effect size, guide them:6667| Source | How to use |68|--------|-----------|69| Prior literature | "What did similar studies find?" |70| Pilot data | Calculate from pilot descriptives |71| SESOI | "What's the smallest effect worth detecting?" |72| Domain norms | Cohen's benchmarks as absolute last resort (small=0.2, medium=0.5, large=0.8 for d) |7374**Never default to Cohen's benchmarks without acknowledging they are arbitrary.**7576---7778## Mode: Design7980### Workflow81821. **Research question interview** — structured questions:83 - What is the causal question?84 - What is the treatment / intervention?85 - What is the primary outcome? Secondary outcomes?86 - What is the target population?87 - What is the assignment mechanism? (random, stratified, clustered, matched)882. **Design specification** — produce a structured document covering:89 - Hypotheses (directional, with expected signs)90 - Conditions (treatment arms, control)91 - Randomization procedure92 - Outcome measures and scales93 - Sample and recruitment strategy94 - Timeline953. **Identification check** — state the estimand, identifying assumptions, and potential threats964. **Write design document** — save to `docs/experiment-design.md` or project-appropriate location975. **Lock the design** — record in `MEMORY.md` Estimand Registry (if project has one) or flag for the user to lock before analysis9899This design document is what `data-analysis` Phase 3 checks for before allowing estimation.100101---102103## Mode: PAP104105Read `references/pap-template.md` for the full template structure.106107### Workflow1081091. **Check for existing design** — look for design document in `docs/`, `log/plans/`, or `.context/`1102. **If no design exists** — run Design mode first, then continue1113. **Generate PAP** — structured pre-analysis plan following AEA/OSF/EGAP conventions:112 - Study information (title, authors, IRB, registration)113 - Design overview (hypotheses, conditions, randomization, sample)114 - Data collection (instruments, timing, blinding)115 - Analysis plan (main specification, inference, multiple testing corrections)116 - Robustness and sensitivity analyses117 - Power analysis (reference or embed results from Power mode)1184. **Output** — save to `docs/pre-analysis-plan.md` (or `.tex` if user prefers LaTeX)1195. **Registration prompt** — remind user to register at AEA RCT Registry, OSF, or EGAP120121---122123## Mode: Survey124125Survey mode is a first-class capability with two entry points: QSF parsing and natural language construction.126127### Entry Point A: QSF Parsing128129When user provides a Qualtrics `.qsf` file:1301311. **Parse the JSON** — extract survey flow, blocks, questions, embedded data, skip logic1322. **Map question types** — read `references/qsf-parsing-guide.md` for type mapping:133 - Matrix, Likert, slider, numeric, constant sum, rank order, best-worst scaling134 - Text entry (single-line, multi-line, essay)135 - Multiple choice (single answer, multiple answer)1363. **Detect design elements:**137 - Factorial conditions from randomizer blocks and embedded data138 - Attention checks and comprehension checks139 - Known validated scales (read `references/known-scales-registry.md`)140 - Skip/display logic and branching1414. **Produce structured summary** — questions, conditions, scales, logic flow, warnings1425. **Flag issues** — missing attention checks, unbalanced conditions, potential order effects143144### Entry Point B: Natural Language Construction145146When user describes an experiment in natural language:1471481. **Parse the design** — extract factorial structure from text149 - Example: "3 (Source: AI vs Human vs None) x 2 (Product: Hedonic vs Utilitarian)" → 3x2 between-subjects1502. **Interview for details:**151 - What DVs to measure? (recommend appropriate scale types)152 - What manipulation checks?153 - What attention/comprehension checks?154 - Demographics and control variables?1553. **Generate survey specification** — structured document with:156 - Survey flow (consent → demographics → manipulation → DVs → manipulation check → debrief)157 - Question text and response options for each item158 - Condition assignments and randomization logic159 - Attention check placement (read `references/survey-design-checklist.md`)1604. **Scale recommendations** — read `references/known-scales-registry.md` for validated scales matching the constructs161162### Survey Quality Checks163164Read `references/survey-design-checklist.md` for the full checklist. Key checks:165166- **Attention checks:** At least 1 per 5 minutes of survey length. Calibrated pass rates (85-95%). See Krosnick (1991), Meade & Craig (2012).167- **Response style mitigation:** Flag scales vulnerable to acquiescence bias. Recommend reverse-coding for scales with 4+ items in the same direction.168- **Scale quality:** Semantic type detection (satisfaction, trust, intention, risk). Reverse-coded item flagging. Well-known scale recognition.169- **Order effects:** Randomize question order within blocks where appropriate. Flag potential priming from early questions.170171---172173## Cross-References174175| Resource | When read |176|----------|-----------|177| `references/power-analysis-recipes.md` | Power mode |178| `references/pap-template.md` | PAP mode |179| `references/survey-design-checklist.md` | Survey mode (quality checks) |180| `references/identification-strategies.md` | Design mode (identification check) |181| `references/qsf-parsing-guide.md` | Survey mode (QSF parsing) |182| `references/known-scales-registry.md` | Survey mode (scale recognition) |183| `design-before-results` rule | Design + PAP modes produce the locked design |184| `data-analysis` skill | Consumes the design document |185| `causal-design` skill | For observational identification (not experiments) |186| `synthetic-data` skill | For generating pilot data |