Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

fect

Read-only

Estimate causal effects from staggered panel data by imputing counterfactual untreated outcomes from untreated cells and averaging observed-minus-imputed outcomes over treated cells.

Instructions

Counterfactual estimators for time-series cross-sectional data (Liu, Wang and Xu 2024): impute the untreated potential outcome of every treated unit-period from a model fitted on untreated cells only -- two-way fixed effects ('fe', the imputation estimator), interactive fixed effects with r factors ('ife'), or nuclear-norm matrix completion ('mc') -- and average Y - Y(0) over treated cells, with the ATT path by relative period. Native port of the R package fect; handles staggered adoption, many treated units, unbalanced panels and treatment reversals. Validation: certified evidence with scoped limitations. Known limitations: Inference is resampling-only (unit bootstrap or jackknife on request); the default returns point estimates only; r and lam are user-supplied; fect's cross-validated choice of r / lambda is not yet supported. Assumptions: Y(0) follows the chosen model (two-way FE / low-rank factors / low nuclear norm) on untreated cells; No anticipation and no carryover after treatment ends; Strict exogeneity of treatment status conditional on the fixed effects / factors. Pre-conditions: long panel with unit x time x outcome and a 0/1 treatment status; every retained unit has a...

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rNoNumber of latent factors (method='ife')
yYesOutcome column
lamNoNuclear-norm penalty on fect's raw scale (method='mc'); the result records lambda_norm = lam / largest singular value.
tolNoEM relative convergence tolerance (fect default)
vceNoResampling standard errors over units; None reports point estimates only.
seedNoBootstrap seed
timeYesTime period column
unitYesUnit identifier
alphaNoSignificance level for confidence intervals and tests.
forceNoAdditive fixed effects in the Y(0) model.two-way
treatYes0/1 treatment status in each unit-period (1 = treated)
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
methodNoY(0) model: 'fe' two-way fixed effects, 'ife' interactive fixed effects with r factors, 'mc' matrix completion with penalty lam.fe
min_t0NoDrop units with fewer untreated periods (fect: 1 for 'fe', 5 otherwise)
n_bootNoBootstrap replications
max_iterNoMaximum EM iterations
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.
covariatesNoTime-varying covariates entering the Y(0) model linearly
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.4/5.0
Behavior5/5

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

The description is rich with behavioral details: it discloses that inference is resampling-only (bootstrap/jackknife), default returns point estimates, r and lam are user-supplied, and cross-validated selection is unsupported. It also lists assumptions about the Y(0) model. These go well beyond the readOnlyHint annotation and are consistent with it.

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 sections for validation, limitations, assumptions, and pre-conditions. It front-loads the core purpose and then provides necessary context. While not minimal, the density is justified by the tool's complexity and the need to convey assumptions and limitations.

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 (22 parameters, multiple methods, assumptions), the description is remarkably complete. It covers the method variants, data requirements, known limitations, and inferential options. The output schema exists, so return values are covered elsewhere. Nothing essential is missing for an agent to call it correctly.

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%, meaning every parameter is already documented in the schema. The description does mention r and lam in the context of methods, but this is redundant with the schema. It adds no new parameter semantics beyond what the schema provides, so a baseline score of 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's purpose: it imputes untreated potential outcomes and computes ATT for panel data using counterfactual estimators. It names the three methods (fe, ife, mc) and explains the underlying approach. This goes beyond the name and distinguishes it from generic estimation tools.

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 (long panel with unit/time/outcome and 0/1 treatment) and assumptions (no anticipation, strict exogeneity) that indicate when the tool is appropriate. It also lists capabilities like staggered adoption and treatment reversals. However, it does not explicitly name alternative tools or state when NOT to use it, leaving some inference to the agent.

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