Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

conley

Read-only

Compute spatial and spatio-temporal HAC standard errors for OLS regressions using a distance-cutoff kernel, yielding valid inference when observations are geographically correlated.

Instructions

Compute Conley (1999) spatial -- and optionally spatio-temporal -- HAC Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact). Cost: Sparse and scale-safe: a scipy cKDTree ball query enumerates only observation pairs within dist_cutoff, so memory is O(n + pairs-within-cutoff) rather than O(n^2). This is the recommended Conley path on large samples -- unlike feols(vce='conley') / hdfe_ols(vce='conley'), which are dense. Cost still grows with dist_cutoff: a cutoff large enough to link most observations recovers the quadratic pair count.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
latYesColumn name for latitude.
lonYesColumn name for longitude.
timeNoColumn name holding the time period. Must be integer-valued. Requires ``lag_cutoff`` and ``unit``.
unitNoColumn name identifying the panel unit. Enables panel de-duplication: the spatial neighbour search runs on the distinct unit coordinates rather than on every row, so a unit observed T times costs one point in the KD-tree instead of T.
alphaNoSignificance level for confidence intervals.
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
kernelNoSpatial kernel: ``"uniform"`` (indicator) or ``"bartlett"`` (linearly declining weight ``1 - d/h``).uniform
resultYesFitted OLS result. Must have ``data_info`` containing ``'X'`` (design matrix), ``'y'`` (response), and ``'residuals'``.
distanceNo``"haversine"`` uses great-circle distance on a sphere of radius 6371 km, and is symmetric. ``"planar"`` reproduces ``acreg``'s convention exactly: 111 km per degree of latitude and ``cos(lat_ref) * 111`` km per degree of longitude, anchored at the *reference* point, which makes the distance asymmetric; the resulting covariance is symmetrised the same way ``acreg`` does (Mata ``_makesymmetric``, which mirrors the lower triangle). Choose ``"planar"`` for bit-level ``acreg`` parity, ``"haversine"`` for a proper great-circle metric.haversine
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.
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.
lag_cutoffNoSerial-correlation bandwidth in periods, for pairs within the same unit. Requires ``time``.
dist_cutoffYesDistance cutoff *h* in kilometres. Pairs farther apart than this receive zero weight.
time_kernelNoTime kernel: ``"bartlett"`` (``1 - |dt| / (lag_cutoff + 1)``, the Newey-West convention, matching ``acreg``'s ``hac bartlett``) or ``"uniform"`` (indicator, matching ``acreg`` without ``hac``).bartlett
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.
lag_cutoff_crossNoTime bandwidth for pairs drawn from *different* units -- ``acreg``'s ``lagdist()``. Defaults to ``0`` (``acreg``'s default), i.e. contemporaneous cross-unit correlation only.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so the safety profile is known. The description adds valuable behavioral context: memory complexity (O(n + pairs-within-cutoff) vs O(n^2)), scaling with dist_cutoff, and the nature of the output (validated evidence tier). No contradiction with annotations.

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 moderately long but each sentence carries purpose: purpose, cost, differentiation, and scaling behavior. It is front-loaded with the main action, and the comparison to alternatives is placed after the core purpose. No wasted words, though it could be slightly tighter.

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

Completeness4/5

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

Given the tool's complexity (18 params, 5 required) and the existence of an output schema, the description covers the key contextual elements: what it computes, cost behavior, and when to use it. It doesn't mention edge cases or prerequisites beyond what the schema already documents, but the output schema fills the return-format gap. A strong overall package.

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?

Schema description coverage is 100%, so each parameter is already documented in detail (e.g., distance, kernel, time_kernel). The tool description adds no new parameter-level semantics beyond what the schema provides; it only ties dist_cutoff to cost, which is more behavioral than parameter meaning. Baseline 3 applies.

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 states a specific verb ('Compute') and resource (Conley HAC) with scope (spatial and spatio-temporal), and explicitly names the validation output tier. It differentiates from siblings by mentioning feols(vce='conley') and hdfe_ols(vce='conley') as dense alternatives, so an agent can distinguish it without inspecting schemas.

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

Usage Guidelines4/5

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

The description gives a clear recommendation: 'This is the recommended Conley path on large samples' and contrasts it with dense alternatives. It also explains the cost trade-off with dist_cutoff. However, it doesn't explicitly state when to prefer the alternatives (e.g., small samples or exact parity needs), leaving some inference.

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