principal_strat
Estimate causal effects within principal strata (e.g., compliers, always-survivors) using monotonicity or covariate-weighting methods, with bounds and bootstrap CIs.
Instructions
Principal Stratification (Frangakis & Rubin 2002). 'monotonicity' method identifies the complier PCE (= LATE) and reports Zhang-Rubin sharp bounds on the always-survivor SACE. 'principal_score' uses Ding-Lu covariate weighting to point-identify stratum-specific effects under principal ignorability. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Known limitations: Always-survivor SACE under encouragement design (Mealli & Pacini 2013, partial identification) is not yet implemented; only AIR / Wald LATE point estimates (tau_Y on outcome, tau_S on the post-treatment stratum) are reported when an instrument is supplied. Assumptions: Monotonicity (no defiers) for method='monotonicity'; Principal ignorability for method='principal_score' (strata perp Y(d) | X); SUTVA and exclusion restriction for the never-takers / always-takers interpretation. Pre-conditions: binary treatment; binary post-treatment stratum variable (compliance, survival, employment, ...); covariates required when method='principal_score' (for Ding-Lu weighting). Failure modes: Zhang-Rubin bounds include 0 and both signs -> Strata partition too weak for point ident...
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| y | Yes | Outcome | |
| seed | No | Random seed for reproducible bootstrap draws | |
| alpha | No | CI level (e.g. 0.05 for 95% CIs) | |
| treat | Yes | Binary treatment | |
| 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 |
| method | No | Identification strategy | monotonicity |
| n_boot | No | Bootstrap replications | |
| strata | Yes | Binary post-treatment variable | |
| 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 | Baseline covariates (required for principal_score) | |
| instrument | No | Binary instrument column. When supplied, switches to the AIR / Wald LATE estimator: under random Z, monotonicity, and exclusion, reports two LATEs among Z-compliers -- tau_Y for the effect of the treatment on the outcome, and tau_S for the effect on the post-treatment stratum variable. method= is ignored on this path. | |
| 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 | |||