🎲 Chi-Square Test Calculator

Goodness-of-fit uses df = k−1−m, where m is the number of parameters estimated from the sample (0 if none); a contingency table uses df = (r−1)(c−1), where c = k/r.

📋 卡方分佈公式

χ² = Σ (Oᵢ − Eᵢ)² / Eᵢ  |  擬合優度 df = k − 1,列聯表 df = (r − 1)(c − 1)
用途:檢驗觀察頻數與期望頻數是否一致(擬合優度)、檢驗兩個分類變數是否獨立(獨立性檢驗)。
判讀:若 p < 0.05,拒絕原假設(即觀察與期望有顯著差異)。

📚 深度解析:卡方計算器

💡 常見使用場景

  • 類別型變數的擬合優度/獨立性檢驗。
  • 遺傳學中檢驗觀測分離比是否符合孟德爾理論比例。
計算
觀測 [30,10]、期望 [25,15]:χ²=(30-25)²/25+(10-15)²/15=1+1.667=2.667,df=1,查表判顯著。

❓ 常見問題(FAQ)

期望頻數為何要≥5?
過小會使卡方近似失真,需合併或 Fisher 檢驗。
自由度怎麼定?
擬合優度檢驗 df=類別數−1;獨立性檢驗 df=(行數−1)×(列數−1)。

Formula & Standard References

Item Formula / Note Source / Standard
Chi-square statistic χ² = Σ (O−E)²/E Pearson 1900; NIST/SEMATECH 1.3.5.9
Degrees of freedom df = (r−1)(c−1) ISO 3534-1 Statistics vocabulary
⚠️ 使用說明與注意事項