did_balance
Audit DiD covariate balance: compute Imbens-Rubin normalized differences on levels and changes (weighted or not) and flag imbalances above 0.25 that threaten parallel trends.
Instructions
Covariate balance for a DiD design, in the shape Baker et al. (2026, Table 4) report it: Imbens-Rubin normalized differences computed twice -- once on baseline covariate LEVELS and once on covariate CHANGES across the treatment date -- optionally weighted and unweighted side by side. The changes panel is the informative half: DiD identifies off trends, so a covariate that is balanced in levels can still be moving differentially, and imbalances routinely flip sign between the two panels. Flags |norm. diff| > 0.25. Evidence about whether UNCONDITIONAL parallel trends is plausible; it cannot test parallel trends itself. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Known limitations: pooled multi-cohort balance is not implemented: one table per treated cohort only, because the normalized difference is a two-group statistic; only the reliability-weight variance correction is implemented for the weighted panel; survey-design (replicate-weight) variances are not supported; inference is not implemented: the normalized difference is reported as a descriptive effect size with no standard error or test, by design; the weighted denomi...
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| g | Yes | First-treatment period (0 = never treated) | |
| i | Yes | Unit identifier | |
| t | Yes | t parameter (str). | |
| cohort | No | Treated cohort to audit (default: the largest) | |
| 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 |
| weights | No | Unit weights; when given, weighted and unweighted statistics are reported side by side because they describe different populations | |
| 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. | |
| threshold | No | Imbens & Rubin (2015, p. 277) rule of thumb | |
| covariates | Yes | Columns to audit in levels and in changes | |
| base_period | No | Pre-treatment period for the levels panel (default g-1) | |
| data_columns | No | Optional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads. | |
| control_group | No | Must match the comparison group of the estimator you intend to run | nevertreated |
| data_sample_n | No | Optional uniform random subsample size (seed=0, deterministic) — useful on huge panels. | |
| comparison_period | No | Second period for the changes panel (default g) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||