| name | simulation-study |
| description | Scaffold and run a reproducible Monte Carlo simulation study in R — parameterized DGP, an estimator grid, a seeded replication loop, and a summary of bias, RMSE, empirical SE, coverage, size/power with Monte Carlo standard errors. Use when the user says "run a Monte Carlo simulation", "simulation study", "check the bias/coverage of an estimator", "compare estimators in simulation", "size and power simulation", "Monte Carlo experiment", or wants to demonstrate an estimator's finite-sample properties. Produces a numbered R script in `scripts/R/` and saves per-replication raw results + a summary table to `scripts/R/_outputs/`. |
| author | Claude Code Academic Workflow |
| version | 1.0.0 |
| argument-hint | [estimator(s) and DGP to study, or path to a script/paper to simulate from] |
| disable-model-invocation | true |
| allowed-tools | ["Read","Grep","Glob","Write","Edit","Bash","Task","Monitor"] |
| effort | high |
/simulation-study — Monte Carlo Simulation Study
Design and run a Monte Carlo experiment that characterizes an estimator's finite-sample behavior, then review it for the bugs that quietly invalidate simulation evidence.
Input: $ARGUMENTS — a description of the estimator(s) and DGP to study (e.g., "compare TWFE vs Callaway–Sant'Anna ATT under staggered adoption with heterogeneous, dynamic effects"), or a pointer to an existing script/paper whose simulation you want to reproduce or extend.
Constraints
- Follow
.claude/rules/simulation-conventions.md — the simulation contract (DGP, truth, estimand, MCSE) is non-negotiable.
- Follow
.claude/rules/r-code-conventions.md for general R standards (header, library() at top, relative paths, numerical discipline).
- Save the script to
scripts/R/ with a numbered, descriptive name (e.g., scripts/R/sim_twfe_vs_csdid.R).
- Save outputs (per-rep raw tibble, summary table, figures) to
scripts/R/_outputs/.
saveRDS() the per-replication raw results, not just the summary — re-aggregation and the review pass need them.
- Run the
sim-reviewer agent on the generated script before presenting results, then address Critical/High findings.
Workflow Phases
Phase 0: Pre-Flight Report
Before writing any code, produce a Pre-Flight Report showing you have pinned down the experiment. This prevents the most common failure mode — a beautiful results table built on a mismatched estimand or a coverage-against-the-estimate bug.
## Pre-Flight Report — Simulation Design
**Research question:** [what finite-sample property is being demonstrated]
**Target estimand:** [ATT / ATE / coefficient θ — and how its TRUE value is computed from the DGP params]
**DGP:** [structure + the parameters that define it; what is held fixed vs. varied]
**Estimator grid:** [list each estimator + which estimand it targets + how it returns est/se/CI]
**Design grid:** [sample sizes, parameter values, scenarios to sweep]
[value] → implied MCSE on coverage ≈ sqrt(0.95·0.05/R) = [value]
bias, empirical SE, RMSE, coverage, size/power — each with MCSE
simulation-conventions.md, r-code-conventions.md