Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

pretrends_test

Read-only

Test whether pre-treatment event-study coefficients jointly differ from zero, validating the parallel-trends assumption in difference-in-differences designs.

Instructions

Joint Wald test of pre-treatment ATTs (or event-study leads) against zero -- the canonical sanity check for the parallel-trends assumption in DiD designs. Failing to reject is necessary but not sufficient evidence for parallel trends; always pair with sp.honest_did / sp.sensitivity_rr for design-robust inference. Assumptions: The test asks whether the pre-period ATTs jointly differ from zero; Failing to reject is consistent with parallel trends but does NOT prove it (low power problem -- Roth 2022). Pre-conditions: result has at least one pre-treatment period coefficient and its variance; covariance between pre-period coefficients is available (cluster-robust SE recommended). Failure modes: Single pre-period (no pretrends to test) -> Pretrends test needs >= 2 pre-treatment periods; widen the panel or drop the test; High-power study rejects but visual pretrends look flat -> Use sp.honest_did + sp.sensitivity_rr to bound the bias; reporting both is standard practice. Alternatives: sp.sensitivity_rr, sp.honest_did, sp.event_study. Typical minimum N: 50.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNoTest statisticwald
alphaNoSignificance level for confidence intervals and tests.
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
resultYesDiD or event-study result with pre-period coefficients
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_pathNoAbsolute 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.
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.8/5.0
Behavior5/5

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

The description discloses the test's statistical behavior and limitations (low power problem, Roth 2022), assumptions (joint test vs zero), and that 'failing to reject is consistent with parallel trends but does NOT prove it.' It also adds practical details like typical minimum N and recommended cluster-robust SE. These go well beyond the readOnlyHint annotation, which only indicates the operation is safe to run.

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 longer than average but tightly packed with essential information, organized into clear sections (purpose, assumptions, pre-conditions, failure modes, alternatives). Every sentence earns its place; no fluff. It could arguably be trimmed slightly, but the density and structure justify the length for a statistically nuanced tool.

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?

Given the tool's complexity mis - a joint pretrends test in DiD - the description covers purpose, usage conditions, assumptions, limitations, failure modes, alternatives, and even practical recommendations (pairing with sp.honest_did, typical minimum N). An output schema exists, so return values need not be described. Nothing an agent needs to correctly invoke this tool is missing.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3. The description adds meaning to the 'result' parameter by specifying pre-conditions: it must contain at least one pre-treatment period coefficient and the covariance between pre-period coefficients. It also recommends cluster-robust SE, directly relevant to the result object. This contextualizes parameters beyond their schema definitions.

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 and resource: 'Joint Wald test of pre-treatment ATTs (or event-study leads) against zero' and names it 'the canonical sanity check for the parallel-trends assumption in DiD designs.' It clearly distinguishes itself from related tools by naming alternatives like sp.honest_did, sp.sensitivity_rr, and sp.event_study.

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 provides explicit when-to-use and when-not-to-use guidance: it specifies pre-conditions (at least one pre-treatment period coefficient, covariance available), failure modes (single pre-period, low power), and directly names alternatives with conditions for switching ('High-power study rejects but visual pretrends look flat -> Use sp.honest_did + sp.sensitivity_rr'). It also advises pairing with other tools as standard practice.

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