Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

model_averaging_dml

Read-only

Estimate causal effects with double machine learning by stacking multiple candidate nuisance learners, reducing sensitivity to any single model and yielding robust treatment-effect estimates with cross-fitting.

Instructions

Model-averaging / stacking DML-PLR estimator. Validation: validated evidence tier (known-truth, reference, external-parity, or Monte Carlo artifact).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yYesOutcome column.
seedNoRandom seed for reproducible stochastic steps.
alphaNoTwo-sided CI level.
treatYesContinuous-or-binary treatment column.
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
n_foldsNoCross-fitting folds per candidate.
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.
candidatesNoCandidate nuisance learners. ``ml_g`` regresses ``y`` on ``X``; ``ml_m`` regresses ``treat`` on ``X``. Defaults to a Lasso/Ridge/ RandomForest/GradientBoosting roster.
covariatesYesCovariate columns ``X``.
weight_ruleNoHow to combine candidate nuisance predictions or estimates. * ``"short_stacking"`` *(default; Ahrens et al. 2025 eq. 7)* -- solve constrained least squares on cross-fitted predictions for each nuisance separately (``y`` and ``D``), produce stacked nuisances, plug into the PLR moment equation. * ``"single_best"`` -- Ahrens et al. (2025, fn. 8): pick the candidate with lowest joint nuisance MSE. * ``"inverse_risk"`` -- :math:`w_k \propto 1/(\text{MSE}_g + \text{MSE}_m)`. Convenience baseline; **not** in the paper. * ``"equal"`` -- :math:`w_k = 1/K`. Convenience baseline; **not** in the paper. For the non-stacking rules (``inverse_risk`` / ``equal`` / ``single_best``) the function computes per-candidate :math:`\hat\theta_k` and reports the weighted average with a between-candidate-covariance-corrected SE; for ``"short_stacking"`` it reports the standard PLR sandwich SE on the stacked-nuisance score (Neyman orthogonality is preserved).short_stacking
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.
sample_weightNoPer-observation weights. If supplied, every nuisance fit uses ``sample_weight=`` (with a graceful fallback warning if the learner does not accept it), the CLS stacking objective becomes weighted least squares, and the PLR moment + sandwich variance use weighted sums. The MSE used for ``inverse_risk`` / ``single_best`` weighting is also the weighted MSE.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.4/5.0
Behavior3/5

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

With readOnlyHint=true, the description does not contradict this; it implies a read/estimation operation. It adds context about validation and the weight_rule parameter in the schema, but the description itself is sparse. It does not disclose potential pitfalls or side effects beyond what annotations already declare. No contradiction.

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

Conciseness3/5

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

The description is a single sentence but is somewhat vague and includes unusual phrasing 'validated evidence tier'. It is front-loaded with the purpose, but the extra clause about validation is unclear and may confuse. It is concise but not perfectly structured for clarity.

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?

Given the tool's complexity (15 parameters, with nuance in weight_rule and detail), the description is minimal. It does not explain return values, but the output schema exists. It lacks guidance on when to use this vs other DML tools, and the validation evidence tier is unexplained. It is adequate for a knowledgeable agent but incomplete for a novice.

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%, and the description itself does not add parameter details, but it references the weight_rule parameter indirectly. The baseline for high coverage is 3, but the description includes a note about validation evidence tier which adds context. However, since coverage is complete, a 4 is justified because the description provides a high-level purpose that aids understanding of parameter intent.

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 states the tool estimates a model-averaging/stacking DML-PLR estimator, which is a specific verb+resource. It mentions 'validated evidence tier' which is unusual and unclear. It distinguishes from siblings like 'dml' and 'dml_diagnostics' by specifying model averaging, but does not explicitly name alternatives. Thus, it is clear but not fully differentiating.

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?

The description implies usage for combining multiple nuisance learners in DML, but does not explicitly state when to use this vs other DML tools (e.g., dml, dml_panel). The detail parameter hints at sub-step calls but does not provide explicit when-to-use or exclusions. It gives some context but lacks direct guidance.

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