Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

overlap_weighted_did

Read-only

Estimate causal effects with overlap-weighted difference-in-differences, down-weighting extreme propensity scores to improve balance when covariate overlap is poor.

Instructions

Overlap-weighted 2x2 DiD. Weights observations by e(X)(1-e(X)), where e(X) is the estimated propensity score, placing highest weight on units with the most overlap between treated and control covariate distributions. Useful when overlap is poor at the tails. Assumptions: Overlap weights target the sub-population with positive overlap; Correct PS model OR outcome model for DR variant; Conditional parallel trends given covariates X after overlap weighting. Pre-conditions: 2 periods, binary treat; covariates with variation; Two-period panel with a binary treat indicator and a binary pre/post time indicator. Failure modes: Propensity scores pile up near 0/1 giving near-zero overlap weights and unstable ATT -> Trim extreme-PS units or simplify the covariate set to restore common support; ps_model='dl' requested but the deep-learning propensity backend fails to converge -> Fall back to ps_model='logit' or 'gbm' for a more stable propensity estimate; More than two time periods passed to this 2x2-only estimator -> Collapse to a single pre/post contrast or use a staggered/multi-period estimator. Alternatives: sp.drdid, sp.did_2x2, sp.did, sp.callaway_santanna. Typical minimum N: 200.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yYesOutcome variable column name or outcome array.
timeYesTime period column.
alphaNoSignificance level for confidence intervals and tests.
treatYesBinary treatment indicator
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
ps_modelNoPropensity score modellogit
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.
covariatesYesCovariates X
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.5/5.0
Behavior4/5

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

Annotations provide readOnlyHint=true, and the description adds substantial behavioral context beyond that: assumptions, target sub-population, failure modes such as extreme propensity scores producing unstable ATT, and fallback strategies for ps_model='dl'. It does not contradict the read-only annotation, and no destructive behavior is implied.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long but densely structured: core definition first, then assumptions, pre-conditions, failure modes, alternatives, and minimum N. Every segment provides actionable guidance and none is redundant with the schema or annotations.

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 estimator tool, the description covers when to use it, its assumptions, data pre-conditions, failure modes with remedies, alternatives, and sample-size guidance. An output schema exists, so return-value details need not be in the description. Nothing material is missing for correct selection and invocation.

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 coverage is 100%, so the schema already documents all parameters. The description adds useful cross-parameter context (e.g., ps_model='dl' may fail to converge; data must be two-period panel with binary treat/time), but it does not re-explain individual parameter formats. Baseline 3 is appropriate because the schema carries the parameter semantics.

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 estimator ('Overlap-weighted 2x2 DiD') and immediately defines its weighting formula and target population. It clearly distinguishes the tool from generic DiD alternatives by naming sp.drdid, sp.did_2x2, sp.did, and sp.callaway_santanna as 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?

Explicitly states when the method is useful ('when overlap is poor at the tails'), lists pre-conditions (2 periods, binary treat, covariates with variation), describes failure modes with concrete remedies, and names alternative estimators for other settings. An agent can decide when to call this tool versus siblings without extra 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