effect_size
Compute effect sizes (Cohen's d, Hedges' g, Cliff's delta) between two groups to quantify the magnitude of differences, with confidence intervals and standard thresholds.
Instructions
effect_size —— 统计推断组 · 效应量(工具 11,简化实现)。
docstring = agent 使用说明书,与 statlab_mcp/docs/design/04_inference_batch2.md 同步维护。
参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) group_col (str): 分组列(须恰好 2 组) value_col (str): 数值列 method (str, "cohens_d"): cohens_d / hedges_g / cliff_delta paired (bool, False): True 时两组样本数必须相等,按"各自有效值序列的 第 i 个"配对(简化语义:无 ID 列时的确定性约定,见设计文档)
口径: cohens_d: |m1-m2|/pooled_sd(pooled_sd 同 hypothesis_test) hedges_g: d * (1 - 3/(4(n1+n2)-9))(小样本修正) cliff_delta: delta = (gt-lt)/(n1n2),gt/lt 为所有跨组值对比较计数(numpy 向量化, 不依赖 mannwhitneyu 的 U 定义,避免方向歧义) CI: 正态近似 se(d/g: sqrt(1/n1+1/n2+d^2/(2(n1+n2)));cliff: sqrt((1-delta^2)/(n1n2))), mean ± 1.96*se;输出注明"正态近似" 阈值(标注为经验惯例):d/g 0.2/0.5/0.8(Cohen);cliff 0.147/0.33/0.474(Romano)
【简化】略过声明: 无 bootstrap CI、无分布假设检验、cliff_delta 无配对版本。
示例: effect_size("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
| Name | Required | Description | Default |
|---|---|---|---|
| method | No | cohens_d | |
| paired | No | ||
| file_path | No | ||
| group_col | No | ||
| value_col | No | ||
| inline_data | No |