ddd
Estimates causal effects with triple differences by adding an unaffected subgroup as a control dimension, relaxing parallel trends to differential trend assumptions.
Instructions
Triple Differences (DDD) estimator. Adds a within-treatment-group subgroup that is unaffected by treatment as an additional control dimension, relaxing parallel trends from 'same trend across groups' to 'same differential trend across subgroups within groups'. Validation: certified parity evidence. Assumptions: Parallel trends in the DDD differential (weaker than DID PT); No anticipation; SUTVA. Pre-conditions: treat x time x subgroup variation exists; subgroup is binary and meaningful within treatment group. Failure modes: Staggered adoption with heterogeneous effects -> Textbook DDD can have negative weights with staggered timing. The Olden-Men (2022) / Strezhnev (2023) heterogeneity-robust DDD is on the roadmap (see docs/rfc/did_roadmap_gap_audit.md Section 4). Alternatives: sp.did_2x2, sp.callaway_santanna. Typical minimum N: 100.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| y | Yes | Outcome variable column name or outcome array. | |
| time | Yes | Time period column. | |
| alpha | No | Significance level for confidence intervals and tests. | |
| treat | Yes | Primary treatment indicator | |
| detail | No | Payload depth: 'minimal' (~150 tokens) for sub-step calls where only the point estimate is needed; 'standard' (~1K tokens) for diagnostics + coefficient table; 'agent' (~2K tokens, default) adds violations / next_steps / suggested_functions so the LLM can plan its next call without another round-trip. | agent |
| robust | No | Robust standard-error or covariance estimator option. | |
| cluster | No | Cluster identifier column for clustered standard errors. | |
| weights | No | Observation weights. | |
| subgroup | Yes | Within-group subgroup (1=affected, 0=not) | |
| as_handle | No | If true, cache the fitted result on the server and return result_id + result_uri alongside the JSON payload so a subsequent tools/call can chain without re-running. | |
| data_path | Yes | Absolute path or URL to a data file. Supported: .csv / .tsv / .txt (delimited), .parquet / .pq, .feather / .arrow, .xlsx / .xls, .dta (Stata), .json / .jsonl. Schemes: file://, s3://, gs://, https://. | |
| result_id | No | Optional handle to a previously-fitted result (returned by an earlier call when as_handle=true). Tools that operate on a fitted object accept this in place of re-supplying data_path + columns. | |
| covariates | No | Covariate matrix, DataFrame, or column names. | |
| data_columns | No | Optional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads. | |
| data_sample_n | No | Optional uniform random subsample size (seed=0, deterministic) — useful on huge panels. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||