Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

hdfe_ols

Read-only

Runs OLS regression with high-dimensional fixed effects, absorbing multiple categorical factors to control for unobserved heterogeneity, while providing robust, clustered, or spatial standard errors for valid causal inference.

Instructions

reghdfe-style OLS with high-dimensional fixed effects. Validation: certified parity evidence. Do NOT use when: vce='conley' on more than ~20,000 rows -- dense O(n^2) memory (see cost); use sp.conley on the fitted result instead. Cost: Absorption is linear in n. vce='conley' is the exception: the within-transformed design goes through conley_vcov_matrix, which builds dense n x n distance and kernel matrices -- ~80 GB at n=100,000. vce='cr2'/'cr3' are per-cluster and cheap by comparison. Assumptions: Linear conditional mean after absorbing high-dimensional fixed effects (Frisch-Waugh-Lovell); Exogeneity of regressors conditional on the absorbed fixed-effect dimensions; Clustered SEs require enough clusters for asymptotics; multiway cluster needs each dimension well-populated. Pre-conditions: Continuous outcome; Fixed-effect factor variable(s) in the '| fe1 + fe2' part of the formula. Failure modes: Singleton groups absorb their own observations and bias clustered SEs -> Keep drop_singletons=True so singletons are removed before estimation; Alternating-projections absorber does not converge -> Raise maxiter / loosen tol, or reduce the number of FE dimensions; Too few clusters make wi...

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tolNoNumerical convergence tolerance.
vceNoCanonical SE-menu keyword (matches ``sp.regress`` / ``sp.feols``): - ``"robust"`` / ``"hc1"`` -- heteroskedasticity-robust on the FE-absorbed design with reghdfe's small-sample factor ``N/(N-k-df_a)``; matches Stata ``reghdfe ..., vce(robust)``. - ``"hc0"`` -- no small-sample factor. - ``"CR2"`` / ``"CR3"`` / ``"jackknife"`` -- Pustejovsky-Tipton (2018) bias-reduced cluster-robust on the within design (requires ``cluster=``, one-way); matches R ``clubSandwich::vcovCR(plm)``. - ``"conley"`` -- Conley spatial HAC on the within design (requires ``conley_lat=/conley_lon=/conley_cutoff=``; Stata ``acreg`` planar distance convention). - ``"wild"`` -- shorthand for ``wild=True`` (requires ``cluster=``).
wildNoIf True (and ``cluster`` is given), return wild-cluster-bootstrap p-values / CIs alongside classical cluster SE. Applied variable- by-variable. Only supported with a single cluster column.
alphaNoSignificance level for confidence intervals and tests.
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
clusterNoOne-way or multi-way cluster column(s).
formulaYes``"y ~ x1 + x2 | fe1 + fe2 + fe3"``. The ``| fe...`` part is optional. Both sides accept bare names, ``c.x`` / ``i.f``, ``a:b``, ``a*b``, ``f1^f2`` and the varying-slope forms ``i.f#c.x`` / ``i.f##c.x`` / ``f[[x]]`` / ``f[x]`` -- see the module docstring for the full grammar.
maxiterNomaxiter parameter (int).
se_typeNoOverride automatic inference of SE type. Usually inferred from ``cluster`` / ``wild``.
weightsNoObservation weights. Column name or raw array.
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_seedNowild_seed parameter (Optional[int]).
conley_latNoCoordinate columns (decimal degrees) for ``vce="conley"``.
conley_lonNoCoordinate columns (decimal degrees) for ``vce="conley"``.
wild_n_bootNoBootstrap replications.
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.
drop_singletonsNodrop_singletons parameter (bool).
wild_weight_typeNowild_weight_type parameter (str).webb

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
Behavior5/5

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

The description goes well beyond the readOnlyHint/openWorldHint annotations by disclosing concrete behavioral traits: dense O(n^2) memory for vce='conley' (~80 GB at n=100,000), linear-cost absorption, the singleton-group bias mechanism and the drop_singletons mitigation, and a non-convergence failure mode for the alternating-projections absorber with maxiter/tol remedies. This is rich behavioral context an agent needs before calling.

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 labeled sections (Validation, Cost, Assumptions, Pre-conditions, Failure modes) and front-loads the core purpose before caveats. The cost discussion is slightly verbose, but each sentence carries operational information, and the structure makes it easy to scan.

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 22-parameter econometric tool, the description covers the essential decision factors: memory scalability, statistical assumptions, input pre-conditions, known failure modes with mitigations, and routing guidance for large datasets. Since an output schema exists, the absence of return-value documentation is acceptable, and the mention of suggested_functions in the detail parameter shows awareness of downstream planning.

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 baseline for this dimension is 3, but the description adds value beyond the schema by explaining the cost implications of vce='conley', characterizing cr2/cr3 as 'per-cluster and cheap,' and linking drop_singletons, maxiter, and tol to specific failure modes. It does not rename or restate parameter syntax, but the behavioral context for key parameters exceeds what the structured fields provide.

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 opening phrase "reghdfe-style OLS with high-dimensional fixed effects" names a specific verb and resource and clearly identifies it as an OLS estimator with HDFE, which separates it from the many poisson/GLM siblings like feglm, fepois, and ppmlhdfe. It does not explicitly name a sibling tool to differentiate itself, so it falls just short of a 5, but the identity is unmistakable.

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 states explicit when-not-to-use guidance: 'Do NOT use when: vce=conley on more than ~20,000 rows' and names the alternative — 'use sp.conley on the fitted result instead.' It also gives conditions for safe use through pre-conditions (continuous outcome, FE factor variables) and warns when to avoid via failure modes.

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