Experiment design

From flonat/flonat-research · View interactive version

Experiment design is an AI agent skill from the GitHub repository flonat/flonat-research. 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.

How to use this skill

Skill file

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

When NOT to Use

Shared References


Mode: Power

Read references/power-analysis-recipes.md for language-specific code patterns.

Workflow

  1. Interview — ask for:
  1. Generate script — R (DeclareDesign/pwr) or Python (statsmodels.stats.power)
  2. Execute and report — produce a sample size table showing N for power = {0.80, 0.90, 0.95}
  3. 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

  1. Research question interview — structured questions:
  1. Design specification — produce a structured document covering:
  1. Identification check — state the estimand, identifying assumptions, and potential threats
  2. Write design document — save to docs/experiment-design.md or project-appropriate location
  3. 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

  1. Check for existing design — look for design document in docs/, log/plans/, or .context/
  2. If no design exists — run Design mode first, then continue
  3. Generate PAP — structured pre-analysis plan following AEA/OSF/EGAP conventions:
  1. Output — save to docs/pre-analysis-plan.md (or .tex if user prefers LaTeX)
  2. 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:

  1. Parse the JSON — extract survey flow, blocks, questions, embedded data, skip logic
  2. Map question types — read references/qsf-parsing-guide.md for type mapping:
  1. Detect design elements:
  1. Produce structured summary — questions, conditions, scales, logic flow, warnings
  2. Flag issues — missing attention checks, unbalanced conditions, potential order effects

Entry Point B: Natural Language Construction

When user describes an experiment in natural language:

  1. Parse the design — extract factorial structure from text
  1. Interview for details:
  1. Generate survey specification — structured document with:
  1. 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:


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 |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.