4.goodness of Fit and Contingency Tables
4.goodness of Fit and Contingency Tables
Tables
主讲老师:刘子真
Chi-square Distribution
𝒁𝟏 , 𝒁𝟐 , … , 𝒁 𝒌 are independent variables following
standard normal distribution, then
𝑸 = 𝒁𝟏 𝟐 + 𝒁𝟐 𝟐 + ⋯ + 𝒁𝒌 𝟐 ~𝝌𝟐𝒌 𝒅𝒆𝒈𝒓𝒆𝒆 𝒐𝒇 𝒇𝒓𝒆𝒆𝒅𝒐𝒎 = 𝒌
Number on die 1 2 3 4 5 6
Observed 23 15 25 18 21 18
Expected 20 20 20 20 20 20
(𝑶𝒊 − 𝑬𝒊 )𝟐
𝑿𝟐 = ~𝝌𝟐𝒏−𝟏
𝑬𝒊
(𝑶𝒊 − 𝑬𝒊 )𝟐
𝑿𝟐 = = 𝟑. 𝟒
𝑬𝒊
Degree of Freedom= 6 − 1= 5
𝝂=𝟓
(𝑶𝒊 − 𝑬𝒊 )𝟐
𝑿𝟐 = = 𝟑. 𝟒
𝑬𝒊
(𝑶𝒊 − 𝑬𝒊 )𝟐
9. Calculate .
𝑬𝒊
(𝑶𝒊 − 𝑬𝒊 )𝟐
𝑿𝟐 = = 𝟔. 𝟐
𝑬𝒊
Since 𝟔. 𝟐 < 𝟏𝟔. 𝟗𝟏𝟗, do not reject the null hypothesis.
There is no evidence that the digits are not random.
𝒙 0 1 2 3 4 5 6 7 8
Frequency 12 28 28 17 7 4 2 2 0
𝒙 0 1 2 3
Probability 0.1074 0.2684 0.3020 0.2013
Expected 10.74 26.84 30.2 20.13
𝒙 4 5 6 7 8
Probability 0.0881 0.0264 0.0055 0.0008 0.0001
Expected 8.81 2.64 0.55 0.08 0.01
𝒙 0 1 2 3 ≥4
Observed 12 28 28 17 15
Expected 10.74 26.84 30.2 20.13 12.09
(𝑶𝒊 − 𝑬𝒊 )𝟐
𝑬𝒊 0.1478 0.0501 0.1603 0.4867 0.7004
Girls 0 or 1 2 3 4 or 5
Observed 31 38 20 11
Expected 18.75 31.25 31.25 18.75
𝟏𝟗𝟗
𝒑= = 𝟎. 𝟑𝟗𝟖
𝟏𝟎𝟎 × 𝟓
Girls 0 1 2 3 4 or 5
Observed 13 18 38 20 11
Expected 7.91 26.14 34.56 22.85 8.54
𝟐. 𝟐𝒏 −𝟐.𝟐
𝑷 𝑿=𝒏 = 𝒆
𝒏!
𝒙 0 1 2 3 4 5 ≥6
E 8.864 19.504 21.448 15.728 8.656 3.808 1.692
𝒙 0 1 2 3 4 ≥𝟓
O 8 19 26 13 7 7
E 8.864 19.504 21.448 15.728 8.656 5.8
(𝑶 − 𝑬 ) 𝟐
𝒊 𝒊
𝑿𝟐 = = 𝟐. 𝟏𝟎𝟏𝟔
𝑬𝒊
Since 𝟐. 𝟏𝟎𝟏𝟔 < 𝟗. 𝟒𝟖𝟖 , do not reject the null
hypothesis. There is no evidence that a Po(2.2)
distribution is not a suitable model.
Height 150- 155- 160- 170- 175- 180- 185- 190-
(cm) 154 159 169 174 179 184 189 194
OB 11 8 8 7 8 9 12 9
𝝌𝟐𝟒 𝟓% = 𝟗. 𝟒𝟖𝟖
(𝑶𝒊 − 𝑬𝒊 )𝟐
𝑬𝒊
= 𝟏𝟐. 𝟏𝟎𝟕𝟒
𝒙 = 𝟏𝟕𝟑. 𝟏𝟓 𝑺𝟐 = 𝟓𝟖. 𝟐𝟐
𝝂 = (𝟑 − 𝟏) × (𝟐 − 𝟏) = 𝟐 𝝌𝟐𝟐 𝟓% = 𝟓. 𝟗𝟗𝟏
(𝑶 − 𝑬)𝟐
𝝌𝟐 = = 𝟑𝟓. 𝟖𝟗𝟐 > 𝟓. 𝟗𝟗𝟏 Reject 𝑯𝟎 .
𝑬