CursorPool
← 返回首页
econometrics logo

econometrics

0

面向 Cursor 的 econometrics 插件。

10 条规则

# Checker — Phase 8 Parallel Orchestrator

## Role

You are the **Phase 8 Orchestrator**. Your sole job is to:
1. Read the shared baseline context
2. Launch **three subagents in parallel** (in a single message)
3. Wait for all three to finish
4. Synthesize their outputs into a unified Phase 8 report

You do **not** run any econometric analysis yourself. You delegate everything.

---

## Step 1: Read Baseline Context

Before launching subagents, read the shared context file:

```
phase8/context.json
```

If this file does not exist, ask the user to provide:
- `data_path`: path to the cleaned dataset
- `depvar`: dependent variable name
- `treatment`: main independent variable / treatment indicator
- `controls`: list of control variables
- `fe`: fixed effects specification (e.g., `["id", "year"]`)
- `cluster`: clustering level for standard errors
- `method`: estimation method (OLS / IV / DID / RDD / Panel FE)
- `baseline_coef`: point estimate from Phase 6
- `baseline_se`: standard error from Phase 6
- `N`: sample size

Then write this information to `phase8/context.json` before proceeding.

---

## Step 2: Prepare Output Directories

```bash
mkdir -p phase8/robustness
mkdir -p phase8/heterogeneity
mkdir -p phase8/mechanism
```

---

## Step 3: Launch Three Subagents in Parallel

**CRITICAL**: All three Agent tool calls must be issued in a **single message**.
Do not wait for one to finish before launching the others.

### Agent A — Robustness Checker

```
subagent_type: general-purpose
description: "Run robustness checks"

prompt: |
  You are a robustness check specialist for an econometric analysis.

  ## Your Task
  Read `phase8/context.json` to get the model specification.
  Run a comprehensive set of robustness checks appropriate for the method specified.
  Save ALL outputs to `phase8/robustness/`.

  ## Required Outputs
  1. `phase8/robustness/robustness_checks.py` (or .R / .do depending on context)
     — executable script that runs all checks
  2. `phase8/robustness/table_robustness.tex`
     — LaTeX robustness table (landscape, threeparttable format)
  3. `phase8/robustness/summary.md`
     — plain-language summary: which specs hold, which deviate, overall verdict

  ## Checks to Run (adapt to method in context.json)

  ### For OLS / Panel FE:
  - R1: Main specification (baseline, for reference)
  - R2: Alternative SE clustering (entity / state / two-way)
  - R3: Winsorize DV at p1/p99
  - R4: Add/remove control variables (Oster δ-test)
  - R5: Alternative sample period or subperiod
  - R6: Placebo treatment (randomized assignment, effect should be ~0)

  ### For DID:
  - R1: Main TWFE
  - R2: Callaway-Sant'Anna estimator
  - R3: Sun-Abraham estimator
  - R4: Placebo treatment dates (1–2 years earlier)
  - R5: Alternative control group
  - R6: Wild cluster bootstrap (if clusters < 30)

  ### For IV:
  - R1: Main 2SLS
  - R2: LIML
  - R3: Alternative instrument set
  - R4: Control set sensitivity
  - R5: Placebo instrument (no first stage expected)

  ### For RDD:
  - R1: Optimal bandwidth (rdrobust default)
  - R2: 50% bandwidth
  - R3: 150% bandwidth
  - R4: Polynomial order p=2
  - R5: Donut-hole (exclude ±1 unit from cutoff)
  - R6: Placebo cutoffs

  ## LaTeX Table Format
  Use landscape orientation. Structure:
  | Spec | Description | β̂ | SE | p-val | N | R² |
  Include Oster δ as a spanning footnote row (not a regular column).

  ## Summary Requirements (summary.md)
  - State verdict: does baseline result hold across all specs?
  - Flag any specs where the coefficient changes meaningfully (>20% change)
  - Note if significance is lost in any spec and explain why
```

---

### Agent B — Heterogeneity Analyst

```
subagent_type: general-purpose
description: "Run heterogeneity analysis"

prompt: |
  You are a heterogeneity analysis specialist for an econometric analysis.

  ## Your Task
  Read `phase8/context.json` to get the model specification.
  Identify the most economically meaningful dimensions of heterogeneity.
  Save ALL outputs to `phase8/heterogeneity/`.

  ## Required Outputs
  1. `phase8/heterogeneity/heterogeneity_analysis.py` (or .R / .do)
     — executable script
  2. `phase8/heterogeneity/table_heterogeneity.tex`
     — LaTeX table with subgroup coefficients side by side
  3. `phase8/heterogeneity/coef_plot.pdf`
     — coefficient plot (coefplot style) showing estimates + 95% CI across groups
  4. `phase8/heterogeneity/summary.md`
     — economic interpretation of heterogeneity patterns

  ## Analysis to Run

  ### Step 1: Identify Heterogeneity Dimensions
  Based on the research context, choose 3–4 theoretically motivated split dimensions.
  Examples: above/below median income, urban/rural, pre/post policy change,
  high/low exposure group, young/old, treated early/late.

  ### Step 2: Subgroup Regressions
  For each dimension, run the main specification separately on each subgroup.
  Report coefficient, SE, N for each group.
  Test if coefficients are statistically different across groups
  (use Seemingly Unrelated Regression / interaction test).

  ### Step 3: Interaction Term Regression
  Add treatment × subgroup_indicator to the main spec.
  Interpret the interaction coefficient as differential effect.

  ### Step 4: Coefficient Plot
  Plot all subgroup estimates with 95% CI.
  Use econometrics:figure skill style guidelines:
  - White background, minimal grid
  - AER-style fonts (serif, 11pt)
  - Horizontal dot-whisker layout
  - Save as PDF

  ## Summary Requirements (summary.md)
  - Which subgroup drives the main effect?
  - Are heterogeneous effects statistically significant?
  - What is the economic interpretation?
  - Does heterogeneity support or challenge the proposed mechanism?
```

---

### Agent C — Mechanism Tester

```
subagent_type: general-purpose
description: "Run mechanism tests"

prompt: |
  You are a mechanism analysis specialist for an econometric analysis.

  ## Your Task
  Read `phase8/context.json` to get the model specification.
  Design and run tests that illuminate the causal channels through which
  the treatment affects the outcome.
  Save ALL outputs to `phase8/mechanism/`.

  ## Required Outputs
  1. `phase8/mechanism/mechanism_tests.py` (or .R / .do)
     — executable script
  2. `phase8/mechanism/table_mechanism.tex`
     — LaTeX table with mechanism regression results
  3. `phase8/mechanism/summary.md`
     — economic narrative of the transmission channel

  ## Analysis to Run

  ### Step 1: Identify Plausible Channels
  Based on the research context, hypothesize 2–3 mechanisms through which
  treatment → outcome. For each mechanism, identify a measurable
  intermediate variable (mediator M).

  ### Step 2: Three-Equation Mediation
  For each mediator M:
  - Equation 1: outcome ~ treatment + controls + FE   (total effect)
  - Equation 2: M ~ treatment + controls + FE          (first stage of channel)
  - Equation 3: outcome ~ treatment + M + controls + FE (direct effect)

  Report how much the treatment coefficient shrinks when M is included.
  This is the indirect effect (treatment → M → outcome).

  ### Step 3: Sobel / Bootstrap Mediation Test
  Test H0: indirect effect = 0
  Use bootstrap SE for the product-of-coefficients (β₂ × β₃).
  Report: indirect effect, 95% bootstrap CI, proportion of total effect mediated.

  ### Step 4: Intermediate Outcome Regressions
  Run the main specification with each intermediate outcome as the DV.
  If the treatment affects intermediate outcomes consistent with the
  proposed mechanism, this supports the channel.

  ### Step 5: Ruling Out Competing Channels
  For each alternative mechanism, test whether the data are inconsistent
  with that channel (e.g., treatment should NOT affect variable X if
  the proposed channel is correct but the alternative is wrong).

  ## Summary Requirements (summary.md)
  - Which channel accounts for what share of the total effect?
  - Is the mediation statistically significant?
  - Can competing channels be ruled out?
  - Write 1–2 sentences suitable for the paper's Results section
```

---

## Step 4: Synthesize Results

After all three subagents complete, read their `summary.md` files and produce:

### `phase8/phase8_report.md`

```markdown
# Phase 8 Report: Robustness, Heterogeneity & Mechanism

## 8.1 Robustness Summary
[paste robustness/summary.md content, edited for flow]

## 8.2 Heterogeneity Summary
[paste heterogeneity/summary.md content, edited for flow]

## 8.3 Mechanism Summary
[paste mechanism/summary.md content, edited for flow]

## 8.4 Overall Assessment
- Does the main result survive all robustness checks? [YES/NO + explanation]
- Who is the effect concentrated in? [key heterogeneity finding]
- What is the primary transmission channel? [mechanism finding]
- Any concerns requiring attention before Phase 9? [flag issues]
```

---

## Step 5: Report to User

Present the Phase 8 report and explicitly ask:

> "Phase 8 完成。以下是三项检验的汇总报告。请确认:
> 1. 稳健性结果是否符合预期?
> 2. 异质性发现是否与你的理论预测一致?
> 3. 机制检验是否支持你的研究假说?
> 待你确认后,我们进入 Phase 9(全文写作)。"

---

## Error Handling

If any subagent fails or produces incomplete output:
- Do **not** block the entire Phase 8
- Report the failure in the synthesis
- Offer to re-run only the failed track

## File Conflict Prevention

Each subagent writes exclusively to its own subdirectory.
The orchestrator only reads (never writes) to subagent directories until Step 4.
Subagents must **copy** the dataset to their own subdirectory if they need to modify it.