Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

functional_form_test

Read-only

Tests if parallel trends hold across all strictly monotonic outcome transformations, revealing whether the functional form drives identification.

Instructions

Roth & Sant'Anna (2023) test of whether parallel trends can hold for EVERY strictly monotonic transformation of the outcome. Bins the outcome, recovers the counterfactual probability mass the design implies for the treated group in each bin via Callaway-Sant'Anna, and tests the moment inequalities that mass must satisfy to be a density. Rejection means levels and logs are answering different questions, so the functional form is doing identifying work. Validation: certified evidence with scoped limitations. Known limitations: a large p-value is only a failure to reject, not evidence FOR functional-form insensitivity: the test has little power with few units or coarse bins; standard errors and the critical value are asymptotic; a bootstrap variant is not implemented. Assumptions: Callaway-Sant'Anna identification for each binned indicator; No anticipation before g - anticipation. Pre-conditions: staggered or single-cohort panel with never-treated or not-yet-treated controls; outcome with enough support to bin. Failure modes: Every bin has a degenerate influence function -> The binning is finer than the data support. Lower n_bins or supply binpoints; Test rejects -> Parallel trends c...

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
gYesFirst-treatment period (0 = never treated)
iYesUnit identifier
tYest parameter (str).
xNoPrimary running variable, regressor, or feature input for this estimator.
yYesOutcome variable column name or outcome array.
alphaNoSignificance level for confidence intervals and tests.
max_eNoOnly bites under aggregation='dynamic': latest event time entering the aggregate
min_eNoOnly bites under aggregation='dynamic': earliest event time entering the aggregate
panelNopanel parameter (bool).
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_binsNoEqual-width outcome bins; too coarse a grid buys a large p-value for nothing. 'auto' follows didFF: an outcome with fewer than 20 distinct untreated values is treated as discrete (one bin per value), otherwise it is cut into min(20, n_distinct) binsauto
n_simsNoDraws behind the least-favourable critical value
weightsNoSampling-weight column; unset weights every unit equally
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.
balance_eNoOnly bites under aggregation='dynamic': keep cohorts observed for this many event times
binpointsNoExplicit bin edges, padded to cover the outcome range if they fall short; cannot be combined with n_bins
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://.
estimatorNoestimator parameter (str).dr
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.
aggregationNoWhich aggte aggregation defines the implied densitygroup
anticipationNoanticipation parameter (int).
data_columnsNoOptional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads.
random_stateNoRandom seed or RandomState for reproducible stochastic steps.
control_groupNocontrol_group parameter (str).nevertreated
data_sample_nNoOptional uniform random subsample size (seed=0, deterministic) — useful on huge panels.
allow_unbalanced_panelNoallow_unbalanced_panel parameter (bool).

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 already set readOnlyHint=true, but the description goes far beyond that. It discloses known limitations (low power with few units, asymptotic SEs, no bootstrap variant), assumptions (Callaway-Sant'Anna identification, no anticipation), and failure modes (degenerate influence functions). This is exemplary behavioral disclosure beyond the structured fields, with no contradictions.

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 long but well-structured with clear labeled sections (Validation, Known limitations, Assumptions, Pre-conditions, Failure modes). It front-loads the core purpose and then systematically adds operational detail. While it could be trimmed slightly, every sentence earns its place by conveying critical interpretive guidance.

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 (26 parameters, output schema present), the description covers assumptions, pre-conditions, failure modes, limitations, and interpretation caveats. It is fully self-contained for an agent to decide when to call it and how to interpret results. The output schema handles return-value documentation, so nothing essential 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 baseline is 3. The description adds meaningful context for key parameters: n_bins ('too coarse a grid buys a large p-value for nothing' plus the 'auto' rule), binpoints (explicit edges, padded), and detail (payload depth rationale). It does not explain every parameter, but it enhances understanding of the ones most likely to affect results, which lifts it above the baseline.

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 ('test'), a precise resource (the functional form of the outcome), and the exact methodological question (whether parallel trends hold for every strictly monotonic transformation). It distinguishes itself from sibling tests by naming the Roth & Sant'Anna (2023) approach and the binned Callaway-Sant'Anna machinery. This is unambiguous and clearly differentiated.

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 provides explicit pre-conditions ('staggered or single-cohort panel with never-treated or not-yet-treated controls; outcome with enough support to bin') and warns against misinterpreting large p-values. It also describes failure modes and how to address them (lower n_bins or supply binpoints). While it does not name alternative tools for the 'when not to use' case, the context is strong enough for an agent to decide applicability. A small deduction for not explicitly comparing to sibling functional-form tests.

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