Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

did_bcf

Read-only

Estimate heterogeneous treatment effects in difference-in-differences designs via Bayesian causal forests, providing per-unit posterior draws adjusted for covariates.

Instructions

Bayesian Causal Forests DiD. Fits a BART-style ensemble with treatment and prognostic terms on the DiD residuals, providing heterogeneous treatment-effect posterior draws per unit. Useful for machine-learning DiD with covariates. Assumptions: Parallel trends: treated and control groups would have followed the same trajectory absent treatment; No anticipation: outcomes in pre-treatment periods are unaffected by future treatment; SUTVA: no spillovers between units. Pre-conditions: data is panel or repeated cross-section with a time column; treat column is binary (0/1) for 2x2, or first-treatment-period (int) for staggered; at least one pre-treatment period (>= 2 periods for 2x2; >= 3 recommended for event study). Failure modes: Pre-trend joint test p < 0.05 (or underpowered at 0.10) -> Use sp.sensitivity_rr (Rambachan & Roth honest CI) or switch to sp.callaway_santanna; Staggered treatment timing with TWFE method -> TWFE can give negative weights; use Callaway-Sant'Anna, Sun-Abraham, or BJS imputation; Pre-trend test underpowered (Roth 2022) -> Check sp.pretrends_power -- if low, report honest CI via sp.sensitivity_rr. Alternatives: sp.did_imputation, sp.drdid, sp.callaway_santanna,...

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yYesOutcome variable column name or outcome array.
idYesUnit, subject, or panel identifier column.
seedNoRandom seed for reproducible stochastic steps.
timeYesTime period column.
alphaNoSignificance level for confidence intervals and tests.
treatYesTreatment indicator or first-treatment-period column.
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_treesNoNumber of trees.
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.
covariatesNoCovariate matrix, DataFrame, or column names.
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?

Annotations mark this as read-only, and the description complements that by explaining what the tool estimates, what assumptions it relies on, and what failure modes may invalidate it. It adds practical behavioral context beyond the annotations without contradicting them.

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 for assumptions, pre-conditions, failure modes, and alternatives. Most sentences carry substantive guidance; only the trailing alternative list is somewhat redundant with the sibling tool list.

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 DiD estimator with 14 parameters, an output schema, and strong assumptions, the description is comprehensive. It covers model mechanics, data requirements, validity conditions, common failure modes, and fallback methods, so an agent has what it needs to invoke the tool correctly.

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 schema already documents all parameters. The description adds useful semantic guidance on key inputs, for example that treat is 'binary (0/1) for 2x2, or first-treatment-period (int) for staggered' and that at least one pre-treatment period is required, which goes beyond the schema's terse descriptions.

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 uses a specific verb ('Fits') and a specific resource ('a BART-style ensemble with treatment and prognostic terms on the DiD residuals') and states the output ('heterogeneous treatment-effect posterior draws per unit'). It clearly differentiates did_bcf from sibling BCF tools by emphasizing the DiD residual construction, and it names alternatives.

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 gives explicit when-to-use context via assumptions, pre-conditions, and failure-mode triggers, such as 'Pre-trend joint test p < 0.05 -> Use sp.sensitivity_rr...' and 'Staggered treatment timing with TWFE method -> use Callaway-Sant'Anna, Sun-Abraham, or BJS imputation.' It also names concrete alternative tools, so an agent can route correctly.

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