Skip to main content
Glama

anova_test

Compare group means across categories with an automated ANOVA workflow: checks variance homogeneity, applies Welch correction when needed, and runs post-hoc tests.

Instructions

anova_test —— 统计推断组 · 方差分析(工具 7,核心实现)。

docstring = agent 使用说明书,与 statlab_mcp/docs/design/04_inference_batch2.md 同步维护。

参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) group_col (str): 分组列(类别或数值均可,按唯一值分组;2~20 组) value_col (str): 数值列(检验对象) alpha (float, 0.05): 显著性水平 ∈ (0,1)

流程(确定性): 1. 前置:Levene 方差齐性(scipy.stats.levene,稳健中位数版)+ 各组 Shapiro (3<=n<=5000 时执行,违反警示不阻断) 2. 方差齐 -> scipy.stats.f_oneway;方差不齐(Levene p<alpha)-> Welch ANOVA (statsmodels.stats.oneway.anova_oneway(use_var="unequal"),避免手写公式出错) 3. 事后:齐 -> Tukey HSD(statsmodels pairwise_tukeyhsd,含 p 值与族校正); 不齐 -> Games-Howell(手写:libqsturng.qsturng 学生化极差临界值, se=sqrt(si2/ni+sj2/nj),显著判定 = |diff| > q*se/sqrt(2); p 值省略并以"CI 是否含 0"判定,输出注明——statsmodels 无现成实现,诚实披露)

示例: anova_test("samples/clean.csv", group_col="category", value_col="score") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
alphaNo
file_pathNo
group_colNo
value_colNo
inline_dataNo

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv1.2.0

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations, the description carries full behavioral burden and succeeds: it discloses a deterministic procedure, exact library calls, post-hoc method selection, and a known limitation (Games-Howell p-values omitted, CI-only judgment, '诚实披露'). It also states that assumption violations warn but do not block execution.

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

Conciseness5/5

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

The description is well-structured with clear sections: parameters, deterministic flow, example, and inline data. It is longer than typical, but the length is justified by the complexity of the statistical behavior and the implementation details needed for correct invocation.

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 data formats, parameter constraints, algorithm fallbacks, post-hoc details, inline_data modes, and example usage, making it nearly complete for invocation. It does not spell out the full return object (e.g., F-statistic, p-value fields) and does not explicitly mark group_col/value_col as required, which matters given there is no output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description compensates fully by defining every parameter: file formats for file_path, grouping semantics and the 2–20 group bound for group_col, numeric requirement for value_col, alpha ∈ (0,1), and the two accepted shapes of inline_data plus the one-of constraint with file_path.

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 leads with '方差分析' (ANOVA) and '统计推断组', naming the exact statistical operation and grouping it among inference tools. The detailed procedure (f_oneway, Welch, Tukey, Games-Howell) distinguishes it clearly from sibling tests like chi_square_test, nonparametric_test, and hypothesis_test.

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?

It provides clear usage context: compare a numeric value across 2–20 groups, with explicit prerequisites (Levene, Shapiro) and automatic selection of classic vs Welch ANOVA. It does not explicitly name alternative tools and the conditions for choosing them, so it falls short of a 5.

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/good-boy4069/statlab-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server