Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

cgs_continuous_did

Read-only

Measure how different treatment doses affect an outcome with continuous difference-in-differences, producing ATT(d) and ACRT(d) curves to answer marginal-dose questions.

Instructions

Callaway, Goodman-Bacon & Sant'Anna (2024) DiD with a CONTINUOUS treatment. A dose has no single ATT: the TWFE coefficient averages the 0.2-dose and 0.8-dose comparisons with weights that can be negative. Reports ATT(d) and its derivative ACRT(d) -- the causal response at dose d, which is what a marginal-dose question asks -- from a B-spline regression of the outcome change on the dose. Validation: certified evidence with scoped limitations. Known limitations: standard errors come from the per-cell influence function; contdid routes its own through the pte aggregation layer, which is not implemented here; staggered designs aggregate cells with StatsPAI's own treated-count weights; only the per-cell estimator is pinned against the reference; the cck (nonparametric) dose estimator is not implemented. Assumptions: Parallel trends in the untreated potential outcome; Strong parallel trends for ATT(d) to be the effect of dose d; No anticipation. Pre-conditions: panel with a continuous dose and some zero-dose units; at least one period before each treated cohort. Failure modes: No zero-dose units in a cell -> ATT(d) is levelled against the zero-dose group. Use control_group='notyettreate...

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yYesOutcome variable column name or outcome array.
doseYesTreatment intensity (0 = untreated)
timeYesTime period column.
unitYesUnit identifier column.
alphaNoSignificance level for confidence intervals and tests.
knotsNoExplicit interior knots
cohortYesFirst-treatment period (0 = never treated)
degreeNoB-spline degree; degree=1 with no knots gives a constant ACRT, the 'effect per unit of dose' reading
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
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://.
dose_gridNoDoses to report the curves at (default: 10th-99th pct)
num_knotsNoInterior knots at dose quantiles; more buys flexibility at the cost of variance and there is no auto-selector
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.
curve_basisNo'fitted' evaluates the curves on the basis they were fitted on; 'reference' re-anchors to the dose grid to reproduce contdid 0.1.1's reported curves, which are a rescaled version of the fitted responsefitted
data_columnsNoOptional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads.
control_groupNocontrol_group parameter (str).nevertreated
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.3/5.0
Behavior5/5

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

Annotations already declare readOnlyHint=true, consistent with an estimation tool. The description adds rich behavioral detail: standard errors from per-cell influence function, how staggered designs aggregate cells with StatsPAI weights, which estimators are pinned against the reference, and that the cck dose estimator is not implemented. It also lists assumptions and failure modes, going well beyond what annotations provide.

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 structured logically: core purpose, validation, limitations, assumptions, pre-conditions, failure modes. It front-loads the main purpose and then details constraints. While verbose, it is organized and every section adds value for an econometric tool with this complexity.

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?

With 18 parameters (6 required) and an output schema present, the description covers limitations, assumptions, pre-conditions, and failure modes. It does not explain every parameter but relies on the schema for that. For a complex estimator, it is reasonably complete, though it could explicitly mention how to handle the no-zero-dose case beyond the truncated control_group hint.

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 all 18 parameters have descriptions. The tool description adds some conceptual framing (e.g., what ACRT means, the role of dose) but does not add significant meaning beyond the schema. Baseline 3 is appropriate.

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 clearly states the tool implements Callaway, Goodman-Bacon & Sant'Anna (2024) DiD for continuous treatments, explains the key concepts (dose, ATT(d), ACRT(d)) and the B-spline regression method. It differentiates itself by focusing on the causal response at dose d, distinguishing it from sibling tools like continuous_did or dose_response.

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?

Provides pre-conditions (panel with continuous dose, zero-dose units, at least one period before each treated cohort), assumptions, and failure modes (no zero-dose units in a cell, use control_group='notyettreate...'). It gives context on when the tool is appropriate but does not explicitly name alternative tools to use instead, relying on the description's specificity to guide selection.

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