Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

kernel_iv

Read-only

Estimate causal effects of a continuous treatment on an outcome using an instrumental variable. Returns nonparametric dose-response curves with uniform confidence bands to support causal decisions.

Instructions

Kernel IV regression with uniform confidence bands (Lob et al. 2025). Estimates the structural function h*(d) = E[Y | do(D=d)] via kernel-weighted local averaging under a continuous instrument Z, with wild-bootstrap uniform SEs. Assumptions: Instrument relevance (non-zero first stage); Exclusion restriction: the instrument affects the outcome only through the treatment; Independence/exogeneity of the instrument; for LATE, monotonicity (no defiers). Pre-conditions: An instrument plausibly affecting treatment, an endogenous treatment, and an outcome; A strong first stage (assess instrument strength before interpreting estimates); formula includes the (endog ~ instruments) parenthesised block. Failure modes: Weak first stage -- biased point estimates and unreliable conventional SEs -> Report first-stage F / effective F and use weak-IV-robust inference (Anderson-Rubin); First-stage F < 10 (Stock-Yogo 5% bias) -> Use weak-IV-robust inference (Anderson-Rubin) or LIML; Over-identification test rejects (sp.estat 'overid') -> At least one instrument is invalid; drop instruments or switch to just-identified LIML. Alternatives: sp.iv, sp.anderson_rubin_ci, sp.dml, sp.deepiv. Typical minimum...

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yYesOutcome variable column name or outcome array.
gridNoGrid of d-values (default 30 quantile-evenly spaced)
seedNoRandom seed for reproducible stochastic steps.
alphaNoSignificance level for confidence intervals and tests.
ridgeNoTikhonov regularisation
treatYesContinuous treatment D
detailNoPayload 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_bootNoNumber of bootstrap replications.
as_handleNoIf 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.
bandwidthNoSilverman default
data_pathYesAbsolute 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_idNoOptional 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.
instrumentYesContinuous instrument Z
data_columnsNoOptional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads.
data_sample_nNoOptional uniform random subsample size (seed=0, deterministic) — useful on huge panels.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only provide readOnlyHint=true, so the description carries the burden of behavioral disclosure. It does this thoroughly: wild-bootstrap uniform SEs, weak-first-stage bias and unreliable conventional SEs, over-identification failure modes, and recommended remedies. There is no contradiction with the read-only annotation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is clearly structured with sections for assumptions, pre-conditions, failure modes, and alternatives, and the main purpose is front-loaded. It is somewhat long and includes post-estimation decision guidance beyond what is strictly required for invocation, but the organization keeps it usable.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex IV tool with an output schema present, the description covers the method, assumptions, preconditions, failure modes, and alternatives. Nothing essential needed to select and invoke the tool correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema covers 100% of the parameters with helpful descriptions, so the baseline is 3. The description adds methodological context but does not meaningfully elaborate on individual parameters such as grid, bandwidth, ridge, or n_boot. The note about the parenthesised formula block is somewhat useful yet not directly mapped to the schema's separate instrument/treat/y fields.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: it estimates the structural function h*(d) = E[Y | do(D=d)] via kernel-weighted local averaging under a continuous instrument Z. It names the method (Kernel IV regression), the exact target, and the estimation strategy, making it clearly distinguishable from siblings like iv, liml, and dml.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description states explicit assumptions (instrument relevance, exclusion restriction, independence, monotonicity for LATE) and preconditions (plausible instrument, endogenous treatment, outcome, strong first stage). It also gives concrete switch-conditions, such as using weak-IV-robust inference or LIML when first-stage F < 10, and names specific alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools