Skip to main content
Glama

stats.chi_square_independence

Read-onlyIdempotent

Test whether two categorical variables in a contingency table are independent using a chi-square test; returns chi-square statistic, degrees of freedom, p-value, and expected frequencies.

Instructions

분할표의 두 범주형 변수가 독립인지 카이제곱 검정으로 판정해 chi2, df, p_value, 기대빈도 표를 돌려준다. observed는 관측 빈도의 2x2 이상 Decimal 문자열 행렬이다. scipy 기본값에 따라 2x2 표에는 Yates 연속성 보정이 적용된다. 결과는 유효숫자 10자리 문자열이다. 비율 자료나 기대빈도가 5 미만인 칸이 많은 표에는 부적합하다.

Input Schema

NameRequiredDescriptionDefault
observedYes

Output Schema

NameRequiredDescriptionDefault
dfYes
chi2Yes
_metaNo서버가 붙이는 영수증(integrity), 엔진, 힌트
traceYes계산 근거(tool, formula, inputs, steps, output)
p_valueYes
expectedYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations only cover safe-read traits, and the description adds genuinely decision-relevant behavior: scipy 기본값 준수, Yates 연속성 보정 applied to 2x2 tables (which changes reported p-values), and 출력 유효숫자 10자리. It does not say how it fails on malformed input (non-numeric strings, 1-row tables), leaving one gap.

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?

Four short sentences, front-loaded with purpose, then input format, then the Yates caveat, then the applicability limit. No padding and nothing buried.

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 single-parameter read-only test with an output schema present, the description covers purpose, input format, correction convention, precision, and misuse conditions. Only error/normalization behavior is unaddressed, which is minor given the output schema already documents returns.

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 0%, so the description carries the burden and does: observed is 관측 빈도의 Decimal 문자열 행렬 with a minimum 2x2 shape. It still does not state whether rows are groups vs. categories, or whether non-negative integers are required, so it is not exhaustive.

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?

States a specific verb and resource — 카이제곱 독립성 검정 on a 분할표 — and enumerates the outputs (chi2, df, p_value, 기대빈도 표). This distinguishes it unambiguously from the probability.chi_square_pdf/cdf/ppf siblings, which compute a distribution rather than test a table.

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?

Gives an explicit exclusion: 비율 자료나 기대빈도가 5 미만인 칸이 많은 표에는 부적합하다. That tells the agent when not to use it. It does not name a sibling alternative (e.g. Fisher exact or stats.anova_oneway for continuous data), so it stops short of full routing 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