例題:
以下のデータについて,「二群の比率の差の検定」を用いて解きなさい。
「学生について,自動車運転免許を持っているかどうかを調査した結果が,表 4,5 のようにまとめられた。男女で免許保有率に差があるかどうか検定しなさい。」
|
|
R による解析:
> prop.test(c(4,1), c(6, 7), correct=FALSE) # 連続性の補正をしない場合 2-sample test for equality of proportions without continuity correction data: c(4, 1) out of c(6, 7) X-squared = 3.7452, df = 1, p-value = 0.05296 alternative hypothesis: two.sided 95 percent confidence interval: 0.06612646 0.98149258 sample estimates: prop 1 prop 2 0.6666667 0.1428571 Warning message: Chi-squared approximation may be incorrect in: prop.test(c(4, 1), c(6, 7), correct = FALSE) > prop.test(c(4,1), c(6, 7)) # 連続性の補正をする場合 2-sample test for equality of proportions with continuity correction data: c(4, 1) out of c(6, 7) X-squared = 1.8591, df = 1, p-value = 0.1727 alternative hypothesis: two.sided 95 percent confidence interval: -0.08863544 1.00000000 sample estimates: prop 1 prop 2 0.6666667 0.1428571 Warning message: Chi-squared approximation may be incorrect in: prop.test(c(4, 1), c(6, 7)) > prop.test(c(40,10), c(60, 70), correct=FALSE) # 連続性の補正をしない場合 2-sample test for equality of proportions without continuity correction data: c(40, 10) out of c(60, 70) X-squared = 37.4524, df = 1, p-value = 9.367e-10 alternative hypothesis: two.sided 95 percent confidence interval: 0.3790774 0.6685416 sample estimates: prop 1 prop 2 0.6666667 0.1428571 > prop.test(c(40,10), c(60, 70)) # 連続性の補正をする場合 2-sample test for equality of proportions with continuity correction data: c(40, 10) out of c(60, 70) X-squared = 35.272, df = 1, p-value = 2.867e-09 alternative hypothesis: two.sided 95 percent confidence interval: 0.3636012 0.6840178 sample estimates: prop 1 prop 2 0.6666667 0.1428571