Skip to main content
Glama
vikranthviki

Causal Decision Agent

by vikranthviki

rddensity

Read-only

Test for RD manipulation by checking density continuity at the cutoff. Uses Cattaneo-Jansson-Ma local polynomial method to return bias-corrected p-value.

Instructions

CJM (2020) density discontinuity test for RD manipulation. Validation: certified evidence with scoped limitations. Known limitations: Certified native reference-parity evidence covers the default rddensity::rddensity unrestricted triangular-kernel selector and test path on the JSS Lee/RD Senate fixture. Manual side-specific bandwidths follow an explicit user-control convention, not a reference-parity guarantee; backend='r' remains available when direct R package execution is required. Assumptions: Cattaneo-Jansson-Ma (2020) local-polynomial density test: under no manipulation the running-variable density is continuous at the cutoff; Density is estimated from the empirical CDF via local polynomial regression with a data-driven CJM bandwidth and bias-corrected inference (no binning); Sufficient mass on both sides of the cutoff within the bandwidth for the polynomial fit of order p. Pre-conditions: Running variable column + cutoff c for the RD density test; Adequate observations on each side of the cutoff within the chosen bandwidth. Failure modes: Too few points on one side of the cutoff for the local polynomial density fit -> Widen the bandwidth h or lower the polynomial order p to...

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cNoRD cutoff.
hNoBandwidth. A scalar applies the same bandwidth on both sides; a length-2 sequence is interpreted as ``(h_left, h_right)``.
pNoPolynomial order for density estimation.
xYesRunning variable.
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
backendNo``"native"`` uses StatsPAI's Python port of the default ``rddensity`` unrestricted triangular-kernel selector/test path. ``"r"`` delegates to ``rddensity::rddensity`` through ``Rscript`` when the R package is installed, matching the reference package's selector and test statistic.native
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.
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.1/5.0
Behavior5/5

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

The description goes well beyond the readOnlyHint annotation by disclosing validation scope, known limitations, assumptions, failure modes, and remediation suggestions. It openly qualifies the native backend's certified behavior and clarifies that manual bandwidths have a different guarantee.

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 well-organized into labeled sections and front-loads the purpose, but it is verbose and includes somewhat redundant validation/limitations phrasing. The final failure-mode sentence appears truncated ('...lower the polynomial order p to...'), which weakens the structural completeness.

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

Completeness4/5

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

The description covers assumptions, preconditions, failure modes, validation limits, and backend options, which is substantial for a complex statistical test. It does not explicitly address sibling-tool selection, and some remediation advice is incomplete, but the output schema and rich parameter schema cover the remaining operational details.

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 is 3. The description adds methodological meaning to key parameters such as h and p by explaining the data-driven CJM bandwidth, bias-corrected inference, and local polynomial fit, and it clarifies the native vs. R backend distinction.

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 states the tool is 'CJM (2020) density discontinuity test for RD manipulation,' identifying a specific test, method, and research context. It does not explicitly differentiate itself from sibling tools such as rdplotdensity or mccrary_test, so it falls short of a 5.

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 concrete pre-conditions and failure modes, including the need for a running-variable column, cutoff, and adequate observations on both sides. It also mentions when 'backend="r"' may be appropriate, but it does not explicitly contrast this tool with alternative RD manipulation tests or plotting tools.

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