Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

feols

Read-only

Estimates OLS and IV regressions with high-dimensional fixed effects, providing robust, clustered, or spatial standard errors to support causal inference and decision-making.

Instructions

Estimate OLS / IV with high-dimensional fixed effects via pyfixest. Validation: certified parity evidence. Do NOT use when: vce='conley' on more than ~20,000 rows -- that path is dense O(n^2) (see cost); use sp.conley on the fitted result, which is sparse and scales. Cost: Default (OLS / HC / CRV1) is linear in n. vce='conley' is the exception: it calls conley_vcov_matrix, which materialises several dense n x n float64 arrays (lat/lon differences, distances, the uniform kernel) -- ~0.8 GB at n=10,000, ~80 GB at n=100,000, ~157 GB at n=140,000. Prefer sp.conley (sparse cKDTree) above ~20,000 rows. Assumptions: Strict exogeneity conditional on the absorbed fixed effects; No perfect collinearity after FE absorption (within-transformation rank); Cluster structure for vcov={'CRV1': '...'} matches the relevant dependence. Pre-conditions: Data is a long-format DataFrame; FE columns are categorical or convertible; Every absorbed FE level has more than one observation (singleton dropping behaviour controlled by drop_singletons); Optional IV stage: instruments are at least as many as endogenous regressors. Failure modes: Singleton groups dropped warning -> Aggregate small categories or...

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fmlYesA pyfixest-style formula. Examples: - ``"Y ~ X1 + X2"`` -- plain OLS - ``"Y ~ X1 | firm + year"`` -- two-way fixed effects - ``"Y ~ 1 | firm | X1 ~ Z1"`` -- IV with fixed effects - ``"Y ~ X1 | csw0(firm, year)"`` -- multiple estimations
sscNoSmall-sample correction via ``pyfixest.ssc()``.
leanNoIf True, drop large intermediate arrays to save memory.
seedNoRNG seed for ``vce="wild"``.
vcovNoVariance-covariance estimator (``vce=`` is the canonical alias). - ``"iid"`` -- classical - ``"HC1"``, ``"HC2"``, ``"HC3"`` -- heteroskedasticity-robust - ``{"CRV1": "firm"}`` -- cluster-robust - ``{"CRV1": "firm + year"}`` -- two-way clustering - ``vce="CR2"`` / ``"CR3"`` / ``"jackknife"`` (with ``cluster=``) -- Pustejovsky-Tipton bias-reduced cluster-robust on the FE-absorbed within design; matches R ``clubSandwich::vcovCR(plm)``. - ``vce="wild"`` (with ``cluster=``) -- WCR wild cluster bootstrap (Cameron-Gelbach-Miller 2008); validated against Stata ``boottest``. - ``vce="conley"`` (with ``conley_lat=/conley_lon=/conley_cutoff=``) -- Conley spatial HAC (Stata ``acreg`` planar-distance convention).
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
clusterNoCluster id column for the extended ``vce=`` menu; also a shorthand for one-way ``{"CRV1": cluster}``.
weightsNoColumn name for regression weights.
fixef_rmNoHow to handle singleton fixed effects: ``"none"`` (keep) or ``"singleton"`` (drop).none
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.
wild_repsNoBootstrap replications for ``vce="wild"``.
collin_tolNoCollinearity tolerance.
conley_latNoCoordinate columns (decimal degrees) for ``vce="conley"``.
conley_lonNoCoordinate columns (decimal degrees) for ``vce="conley"``.
data_columnsNoOptional column projection. Parquet/Feather/Stata loaders honour this for fast partial reads.
conley_cutoffNoConley distance cutoff in km for ``vce="conley"``.
data_sample_nNoOptional uniform random subsample size (seed=0, deterministic) — useful on huge panels.
wild_weight_typeNoWild weight distribution (``"rademacher"``, ``"webb"``, ``"mammen"``).rademacher

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?

Annotations only declare readOnlyHint=trueusters. The description adds substantial behavioral context: computational complexity (dense O(n^2) for conley), concrete memory estimates (~0.8 GB at n=10,000, ~157 GB at n=140,000), statistical assumptions (strict exogeneity, no perfect collinearity), singleton handling, and failure modes. This goes well beyond the annotations and helps the agent anticipate the tool's runtime and correctness requirements.

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 sections (Validation, Do NOT use when, Cost, Assumptions, Pre-conditions, Failure modes). It front-loads the core purpose, then organizes warnings and technical context logically. Each section earns its place; while condensed, it remains actionable for a complex 20-parameter tool.

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 high-dimensional fixed effects estimator with an output schema, the description is remarkably complete: it covers validation evidence, cost and memory behavior, assumptions, pre-conditions, failure modes, and guidance on alternatives for the conley case. The presence of an output schema means return-value details are already structured, and the description fills the behavioral and contextual gaps.

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 baseline is 3. The description enriches the vcov parameter with cost/alternative guidance and adds context to the fml parameter about IV requirements. However, it references 'drop_singletons' while the schema defines 'fixef_rm', creating a naming mismatch that could confuse an agent. This prevents it from scoring higher.

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 opens with 'Estimate OLS / IV with high-dimensional fixed effects via pyfixest', which is a specific verb, resource, and method. It clearly distinguishes this tool from generic regression siblings like 'regress' and from Poisson/FE variants such as 'fepois'. It also includes validation parity evidence, reinforcing the purpose.

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 'Do NOT use when' clause explicitly warns against using vce='conley' on large datasets and names the preferred alternative (sp.conley). Pre-conditions further define appropriate contexts (long-format data, categorical FE columns, instrument sufficiency). However, it does not explicitly name sibling tools for the main use case, leaving some routing implicit in the purpose statement.

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