Skip to main content
Glama

Stat Correlation

stat_correlation

Computes Pearson, Spearman, Kendall, or robust correlations between two continuous variables and reports r or rho with confidence intervals, helping assess linear or monotonic association.

Instructions

Correlation between two continuous variables.

WHEN TO USE

  • pearson: both continuous, relationship linear, no severe outliers.

  • spearman: ordinal data, monotonic but non-linear relationships, or outliers.

  • kendall: small n with many ties.

  • percbend / shepherds / bicor: robust alternatives when outliers are a concern.

WHEN NOT TO USE

  • Repeated measurements on the same participants → stat_rm_correlation; a plain correlation is inflated by between-subject variance.

  • To establish agreement between two measurement methods → stat_plot_blandaltman; correlation measures association, not agreement.

  • To claim "no relationship" from a non-significant r → check stat_distance_correlation, which detects non-linear dependence.

Always report r (or rho) with its CI, not just the p-value.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "name": "<name>",
      "x": "<x>",
      "y": "<y>"
    },
    "name": "stat_correlation"
  }
}

Input Schema

NameRequiredDescriptionDefault
xYes
yYes
nameYes
methodNopearson
alternativeNotwo-sided

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

No annotations exist, so the description carries the full burden; it does disclose the method families and their robustness properties (percbend/shepherds/bicor as outlier-robust), which is real behavioral context. It stops short of stating handling of missing data, non-numeric input, or whether the CI is computed automatically (it only admonishes to report one), so some behavioral surface is left implicit.

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?

Headers front-load the decision-relevant content, and each method line earns its place with a concrete selection criterion. The closing reporting admonition ("Always report r with its CI") is sound statistical advice but is output/reporting policy rather than tool-selection guidance, so it is slightly outside the definition's remit.

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?

For a statistical test tool with an output schema, the return values need not be described, and the method-selection and routing content is thorough. What remains missing is enough about the variable-name parameters and the `alternative` option to let an agent populate the call confidently from the description alone.

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 0% with five parameters and no enums, so the description must compensate. It does so well for `method` by enumerating the accepted values and their statistical rationale — the single most consequential gap in the schema — but says nothing about `x`, `y`, `name`, or `alternative`, leaving four parameters including two required ones undefined in both places.

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?

Opens with a precise statement of the resource and scope: a correlation between two variables, with the supported method families enumerated. The when-not-to-use block names the exact siblings it is not (stat_rm_correlation, stat_plot_blandaltman, stat_distance_correlation), so an agent can discriminate it from a catalog of ~20 stat_* tools without opening any schema.

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?

Gives explicit when-to-use per method (pearson for linear continuous data, spearman for ordinal/monotonic, kendall for small n with ties, robust variants for outliers) and explicit when-not-to-use with the alternative tool named for each case. This is the strongest possible form of routing guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.