did
Estimate difference-in-differences treatment effects for two-period or staggered panel data, with automatic method selection and support for Callaway-Sant'Anna, Sun-Abraham, BJS, SDID, and DDD.
Instructions
Difference-in-differences dispatcher. 2x2 (two periods, 0/1 treat) when id is omitted; with id, a 0/1 indicator on a multi-period panel is converted to first-treatment cohorts and Callaway-Sant'Anna runs. Pass method= to force '2x2', 'cs', 'sa', 'bjs', 'sdid' or 'ddd'. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact).
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"time": "<time>",
"treat": "<treat>",
"y": "<y>"
},
"name": "did"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| y | Yes | Outcome column | |
| id | No | Unit identifier; required for staggered designs (method='cs'/'sa'/'bjs') and SDID | |
| time | Yes | Time period column | |
| treat | Yes | Binary treatment indicator (0/1) or first-treatment period column (0 = never treated) | |
| detail | No | Payload depth; agent is the fullest. | agent |
| method | No | Estimator (see sp.describe_function('did')). | auto |
| parity | No | ||
| cluster | No | Cluster column for cluster-robust SEs | |
| data_id | No | Data handle (d_...) from load_data; replaces data_path. | |
| data_csv | No | Small inline table as CSV text. | |
| subgroup | No | Affected-subgroup column (method='ddd' only) | |
| as_handle | No | Cache the fit and return its result_id. | |
| crit_dist | No | ||
| data_path | No | Absolute path of a data file on the server. | |
| result_id | No | Handle of an earlier fit made with as_handle=true. | |
| covariates | No | Optional control columns | |
| aggregation | No | Callaway-Sant'Anna aggregation of ATT(g,t) | |
| data_records | No | Small inline table as row objects. | |
| max_output_bytes | No | Result byte budget (default 262144; 0 = none). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||