卡方检验计算器

χ² = Σ (Oᵢ − Eᵢ)² / Eᵢ

Enter observed and expected frequencies to compute the chi-square statistic and judge whether the deviation is significant, for goodness-of-fit and independence tests.

📐 计算公式
卡方统计量 χ² = Σ (观测值 O − 期望值 E)² ÷ E,求和项数 n = 序列长度(O 与 E 个数必须一致,不一致提示报错;E≤0 提示报错);自由度 df = n − 1。校验:观测值与期望值为必填项(逗号分隔数值,必填校验壳拦截空值)。判据:χ² 越大观测与期望偏离越显著,可对照自由度 df 的卡方临界值表判断显著性(结果保留 4 位小数)。

观测值与期望值偏离程度。

📌 计算说明
  • χ² = Σ(O−E)²/E。
  • df = 类别数 − 1。

📚 深度解析:卡方拟合优度/独立性检验

💡 常见使用场景

2×2 独立性
观察 O=[60,40;30,70](行列和均 100),期望 E=50 各格:χ²=(10²+10²+20²+20²)/50=(100+100+400+400)/50=1000/50=20。df=1,远超临界 3.84,显著相关。
拟合优度
抛硬币 100 次期望 50/50,观察 60/40:χ²=(10²+10²)/50=4,df=1,p≈0.045,临界显著。

❓ 常见问题(FAQ)

期望频数怎么定?
独立性检验 E_ij=行和_i×列和_j/总计;拟合检验按理论比例分配。任一期望<5 宜合并或用法氏校正。
χ² 越大说明什么?
χ² 大表示观察与期望偏离大,越可能拒绝原假设(独立/拟合)。

Formula & Standard References

Item Formula / Note Source / Standard
Chi-square statisticχ² = Σ(O − E)² ÷ E with E = row total × column total ÷ grand totalPearson 1900, Philosophical Magazine
Degrees of freedomFor independence tests df = (rows − 1) × (columns − 1)Standard contingency-table analysis
Expected-count conditionAll expected counts ≥1 and <5 in ≤20% of cells, else use Fisher exact testCochran 1954 rule
Cramér's VV = √(χ² ÷ (n × min(r−1, c−1))), 0–1 association strengthCramér 1946, Mathematical Methods of Statistics