English
The chi-squared test 卡方检验 compares the results you actually counted (the observed numbers, $O$) with the results you expected from the genetic diagram (the expected numbers, $E$). It tells you whether the difference is small enough to be due to chance, or large enough to mean something else is going on.
You add up, for every group, the squared difference between observed and expected, divided by the expected:
$$\chi^2 = \sum \frac{(O - E)^2}{E}$$
Then you compare this $\chi^2$ value with a critical value from a table. The row you use is set by the degrees of freedom (the number of groups minus 1). If $\chi^2$ is less than the critical value, the difference is not significant — the results fit the expected ratio, and any difference is just chance. If $\chi^2$ is greater than the critical value, the difference is significant, so some other factor is involved.
Worked example. A $\text{Tt} \times \text{Tt}$ cross gives $160$ offspring: $114$ tall and $46$ short. Test whether this fits the expected $3:1$ ratio.
The expected numbers are $\tfrac{3}{4} \times 160 = 120$ tall and $\tfrac{1}{4} \times 160 = 40$ short. Then:
$$\chi^2 = \frac{(114 - 120)^2}{120} + \frac{(46 - 40)^2}{40} = \frac{36}{120} + \frac{36}{40} = 0.30 + 0.90 = 1.20.$$
There are $2$ groups, so degrees of freedom $= 2 - 1 = 1$. The critical value at $p = 0.05$ is $3.84$. Because $1.20 < 3.84$, the difference is not significant: the results fit a $3:1$ ratio, and the small difference is due to chance.
ไทย
การทดสอบ chi-squared เปรียบเทียบผลลัพธ์ที่คุณนับจริง (จำนวน สังเกต, $O$) กับผลลัพธ์ที่คุณคาดหวังจากแผนภาพพันธุศาสตร์ (จำนวน คาดหวัง, $E$) มันบอกว่าคุณว่าความแตกต่างนั้นเล็กพอที่จะเกิดจากความบังเอิญ หรือใหญ่พอที่จะหมายถึงว่ามีปัจจัยอื่น起作用อยู่
คุณบวกผลรวม สำหรับแต่ละกลุ่ม กำลังสองของความแตกต่างระหว่างสิ่งที่สังเกตได้กับสิ่งที่คาดหวัง หารด้วยสิ่งที่คาดหวัง:
$$\chi^2 = \sum \frac{(O - E)^2}{E}$$
จากนั้นคุณเปรียบเทียบค่า $\chi^2$ นี้กับ ค่าวิกฤต จากตาราง แถวที่คุณใช้จะกำหนดโดย ดีกรีของอิสรภาพ (จำนวนกลุ่มลบด้วย 1) หาก $\chi^2$ น้อยกว่า ค่าวิกฤต ความแตกต่างจะไม่มีความหมายทางสถิติ — ผลลัพธ์สอดคล้องกับอัตราส่วนที่คาดหวัง และความแตกต่างที่เกิดขึ้นเป็นเพียงความบังเอิญเท่านั้น หาก $\chi^2$ มากกว่า ค่าวิกฤต ความแตกต่างมีความหมายทางสถิติ ดังนั้นจึงมีปัจจัยอื่นใดบางอย่างเข้ามาเกี่ยวข้อง
ตัวอย่างวิธีทำ การผสมข้ามกัน $\text{Tt} \times \text{Tt}$ ให้ลูก offspring数量为 $160$: $114$ สูงและ $46$เตี้ย ตรวจสอบว่าผลลัพธ์นี้สอดคล้องกับอัตราส่วนที่ $3:1$ ที่คาดหวังหรือไม่
จำนวนที่คาดหวังคือ $\tfrac{3}{4} \times 160 = 120$ สูงและ $\tfrac{1}{4} \times 160 = 40$ เตี้ย จากนั้น:
$$\chi^2 = \frac{(114 - 120)^2}{120} + \frac{(46 - 40)^2}{40} = \frac{36}{120} + \frac{36}{40} = 0.30 + 0.90 = 1.20.$$
มี $2$ กลุ่ม ดังนั้นดีกรีของอิสรภาพ $= 2 - 1 = 1$. ค่าวิกฤตที่ $p = 0.05$ คือ $3.84$. เนื่องจาก $1.20 < 3.84$, ความแตกต่าง ไม่มีความหมายทางสถิติ: ผลลัพธ์สอดคล้องกับอัตราส่วน $3:1$ และความแตกต่างเล็กน้อยเกิดจากความบังเอิญ