network_exposure
Estimate causal effects under network interference using a Horvitz-Thompson estimator with user-supplied exposure mappings. Handles Bernoulli randomization with conservative variance.
Instructions
Aronow-Samii Horvitz-Thompson estimator for arbitrary interference via a user-supplied exposure mapping. Handles Bernoulli randomisation designs with simulated conservative variance. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Known limitations: design='complete' is reserved but not implemented; passing it raises NotImplementedError. Use design='bernoulli' with p_treat=K/N as an approximation only if that matches the assignment mechanism you are willing to assume. Assumptions: Exposure mapping is correctly specified (as4 / as3 / as2 -- Aronow-Samii hierarchy); Positivity: every exposure level has positive probability under the design; Network adjacency is fixed / known (measurement error in ties introduces bias). Pre-conditions: adjacency is a binary n x n matrix encoding network ties; Y, Z have same length n; randomisation design is known (bernoulli with p_treat, or complete). Failure modes: Some exposure level has < 5 observed units -> Switch to a coarser mapping (as4 -> as3) or increase sample size; Variance estimate extremely conservative (wide CI) -> HT-style variance is conservative by design -- use sp.spillover for...
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Y | Yes | Outcome vector | |
| Z | Yes | Treatment vector (0/1) | |
| n_sim | No | Number of sim. | |
| design | No | Randomisation design | bernoulli |
| 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 |
| mapping | No | Exposure mapping | as4 |
| p_treat | No | Marginal treatment probability | |
| adjacency | Yes | Adjacency matrix (n x n) or sparse | |
| 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 | No | 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. | |
| 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 | |||