normality_test
Check if a numeric column is normally distributed via Shapiro-Wilk or D'Agostino-Pearson tests. Outputs p-value, skew, kurtosis, and normality verdict at alpha=0.05.
Instructions
normality_test —— 统计推断组 · 正态性检验(工具 9,核心实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/03_inference_batch1.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) column (str): 分析列(须为数值列) method (str, "auto"): auto / shapiro / dagostino auto: n<=5000 -> Shapiro-Wilk(scipy 官方建议 3~5000);5000<n<=100000 -> D'Agostino-Pearson(scipy.stats.normaltest);n>100000 -> 中文报错提示抽样
输出: method_used, n, statistic, p_value, skew(Fisher 样本偏度,同 describe), kurtosis(超额峰度,正态=0), normal(判定 = p_value > 0.05), threshold_alpha(固定 0.05 并在输出注明)
边界: n<3 / 常数列(方差 0)/ 显式 shapiro 但 n>5000(scipy 限制)/ dagostino 且 n<8(scipy 要求)/ 非数值或缺失列 —— 全部中文报错。
示例: normality_test("samples/clean.csv", column="score") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| column | No | ||
| method | No | auto | |
| file_path | No | ||
| inline_data | No |