Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

etwfe

Read-only

Estimates average treatment effects on treated using extended two-way fixed effects, with support for linear, count, and binary outcomes.

Instructions

Extended Two-Way Fixed Effects (Wooldridge 2021). Explicit API mirroring the R etwfe package. The headline reports the treated-observation-weighted simple ATT from etwfe::emfx(type='simple') / Stata jwdid, with cgroup selecting not-yet-treated or never-treated controls. family='poisson'/'logit' switches to Wooldridge (2023) nonlinear ETWFE for count / binary outcomes, reporting the average marginal effect on the response scale. Validation: certified evidence with scoped limitations. Known limitations: cgroup='nevertreated' combined with panel=False (repeated cross-sections) is not yet supported; pass either panel=True with cgroup='nevertreated' or panel=False with cgroup='notyet'; family='poisson'/'logit' with xvar, panel=False, or cgroup='nevertreated' is not yet supported; these raise rather than being silently ignored; family='poisson'/'logit' reports an average marginal effect on the response scale (counts / probability) rather than a link-scale coefficient -- the R etwfe::emfx convention; cgroup='nevertreated' combined with panel=False (repeated cross-sections) is not yet supported. Use panel=True with cgroup='nevertreated' or panel=False with cgroup='notyet'. Do NOT use when...

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yYesOutcome variable column name or outcome array.
timeYesTime period column.
xvarNoR-style alias for controls
alphaNoSignificance level for confidence intervals and tests.
groupYesGroup or cohort identifier.
panelNoIf False, treat data as repeated cross-section
cgroupNoControl group: 'notyet' (not-yet-treated) or 'nevertreated'. The latter is only supported when panel=True.notyet
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
familyNoOutcome model. None/'gaussian' is the linear ETWFE. 'poisson' (counts) and 'logit' (binary) fit Wooldridge (2023) nonlinear ETWFE by MLE and report the average marginal effect on the response scale, matching R etwfe::emfx. The nonlinear branch requires panel=True, cgroup='notyet', and no xvar.
clusterNoCluster identifier column for clustered standard errors.
controlsNoControl-variable column names.
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.
first_treatYesfirst_treat parameter (str).
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

A3.5/5.0
Behavior4/5

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

The description goes well beyond the readOnlyHint and openWorldHint annotations: it discloses that unsupported combinations raise rather than being silently ignored, that nonlinear family reports response-scale average marginal effects rather than link-scale coefficients, and that cgroup='nevertreated' with panel=False is unsupported. It is transparent but not perfect, because the 'Validation: certified evidence with scoped limitations' phrase is vague.

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

Conciseness2/5

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

The description front-loads the estimator identity and headline result, but it is repetitive: the cgroup='nevertreated' combined with panel=False limitation appears twice almost verbatim, and the unsupported-combination/family constraints are stated more than once. The trailing 'Do NOT use when...' fragment also makes the structure feel unfinished.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 17-parameter tool with rich schema and an output schema, the description covers the headline estimand, nonlinear variants, supported control groups, panel assumptions, and known unsupported combinations. Still, the truncated 'Do NOT use when...' clause and the vague 'certified evidence with scoped limitations' leave gaps in deciding when not to invoke this tool.

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?

The input schema already documents all 17 parameters with 100% coverage, so the baseline is 3. The description adds genuine value by explaining the behavioral meaning of key parameters: cgroup selects not-yet-treated vs never-treated controls, panel=False means repeated cross-sections, and family='poisson'/'logit' switches to Wooldridge (2023) nonlinear ETWFE with AMEs on the response scale.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly expands the acronym to 'Extended Two-Way Fixed Effects (Wooldridge 2021)' and states the headline estimand: the treated-observation-weighted simple ATT from etwfe::emfx(type='simple') / Stata jwdid, plus the nonlinear family variants. It is specific about what the tool estimates, though it does not explicitly differentiate itself from close siblings like etwfe_emfx or wooldridge_did.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It provides concrete guidance for choosing family and control-group variants: gaussian vs poisson/logit, not-yet-treated vs never-treated, and panel=True vs panel=False constraints. However, it never explicitly names an alternative tool for when this one should not be used, and the final 'Do NOT use when...' sentence is cut off, so the exclusion guidance is incomplete.

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