Skills

Simulation Study

Scaffold and run a reproducible Monte Carlo simulation study in R, a declared...

Install

npx skills add pedrohcgs/claude-code-my-workflow --skill simulation-study -g -a claude-code -y
Category
Engineering
Updated
1mo ago
License
MIT
Context cost
Mediumabout 2,623 tokens
Runs scripts
No, instructions only

What it does

Scaffold and run a reproducible Monte Carlo simulation study in R, a declared assumption regime, a 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 `output/`.

/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 2SLS vs LIML under weak instruments with heteroskedasticity"), 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, assumption regime) is non-negotiable.
  • Declare the assumption regime in the script header and respect the firewall, an out-of-assumption run never supports a within-assumption claim (simulation-conventions.md §2).
  • 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_2sls_vs_liml.R).
  • Save outputs (per-rep raw tibble, summary table, figures) to output/.
  • 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
Read the whole SKILL.md on GitHub

More in Engineering