zero_first_stage
Tests instrument validity by checking its effect where it has no first stage, then quantifies bias and returns a pleiotropy-robust corrected estimate with bootstrap confidence intervals.
Instructions
Zero-first-stage (ZFS) test of the exclusion restriction, plus van Kippersluis-Rietveld (2018) pleiotropy-robust correction. Estimates the instrument's direct effect on the outcome in a subsample where it has no first stage, reports the implied bias in the main-sample IV estimate, and returns the corrected point estimate with a cluster-bootstrap interval. Accepts the same exog / absorb / cluster spec as sp.iv, so the test runs on the specification actually fitted.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| y | Yes | Outcome column | |
| zfs | Yes | Boolean column/mask marking the zero-first-stage subsample where the instrument is believed inert | |
| exog | No | exog parameter (list[str] | str). | |
| alpha | No | Significance level for confidence intervals and tests. | |
| endog | Yes | Endogenous regressor | |
| absorb | No | Fixed effects absorbed in every component regression | |
| 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_boot | No | Bootstrap reps for the corrected estimate (0 to skip) | |
| cluster | No | Cluster identifier column for clustered standard errors. | |
| 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. | |
| instrument | Yes | The single excluded instrument being tested | |
| 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. | |
| data_sample_n | No | Optional uniform random subsample size (seed=0, deterministic) — useful on huge panels. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||