functional_form_test
Tests if parallel trends hold across all strictly monotonic outcome transformations, revealing whether the functional form drives identification.
Instructions
Roth & Sant'Anna (2023) test of whether parallel trends can hold for EVERY strictly monotonic transformation of the outcome. Bins the outcome, recovers the counterfactual probability mass the design implies for the treated group in each bin via Callaway-Sant'Anna, and tests the moment inequalities that mass must satisfy to be a density. Rejection means levels and logs are answering different questions, so the functional form is doing identifying work. Validation: certified evidence with scoped limitations. Known limitations: a large p-value is only a failure to reject, not evidence FOR functional-form insensitivity: the test has little power with few units or coarse bins; standard errors and the critical value are asymptotic; a bootstrap variant is not implemented. Assumptions: Callaway-Sant'Anna identification for each binned indicator; No anticipation before g - anticipation. Pre-conditions: staggered or single-cohort panel with never-treated or not-yet-treated controls; outcome with enough support to bin. Failure modes: Every bin has a degenerate influence function -> The binning is finer than the data support. Lower n_bins or supply binpoints; Test rejects -> Parallel trends c...
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| g | Yes | First-treatment period (0 = never treated) | |
| i | Yes | Unit identifier | |
| t | Yes | t parameter (str). | |
| x | No | Primary running variable, regressor, or feature input for this estimator. | |
| y | Yes | Outcome variable column name or outcome array. | |
| alpha | No | Significance level for confidence intervals and tests. | |
| max_e | No | Only bites under aggregation='dynamic': latest event time entering the aggregate | |
| min_e | No | Only bites under aggregation='dynamic': earliest event time entering the aggregate | |
| panel | No | panel parameter (bool). | |
| 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 |
| n_bins | No | Equal-width outcome bins; too coarse a grid buys a large p-value for nothing. 'auto' follows didFF: an outcome with fewer than 20 distinct untreated values is treated as discrete (one bin per value), otherwise it is cut into min(20, n_distinct) bins | auto |
| n_sims | No | Draws behind the least-favourable critical value | |
| weights | No | Sampling-weight column; unset weights every unit equally | |
| 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. | |
| balance_e | No | Only bites under aggregation='dynamic': keep cohorts observed for this many event times | |
| binpoints | No | Explicit bin edges, padded to cover the outcome range if they fall short; cannot be combined with n_bins | |
| 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://. | |
| estimator | No | estimator parameter (str). | dr |
| 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. | |
| aggregation | No | Which aggte aggregation defines the implied density | group |
| anticipation | No | anticipation parameter (int). | |
| data_columns | No | Optional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads. | |
| random_state | No | Random seed or RandomState for reproducible stochastic steps. | |
| control_group | No | control_group parameter (str). | nevertreated |
| data_sample_n | No | Optional uniform random subsample size (seed=0, deterministic) — useful on huge panels. | |
| allow_unbalanced_panel | No | allow_unbalanced_panel parameter (bool). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||