例題:
「ABO 式の血液型を調べたところ,表 1 のような結果であった。男女で血液型の分布がことなるだろうか。」
| 性別 | A | B | O | AB | 合計 |
|---|---|---|---|---|---|
| 男 | 20 | 15 | 16 | 4 | 55 |
| 女 | 15 | 7 | 9 | 4 | 35 |
| 合計 | 35 | 22 | 25 | 8 | 90 |
R による解析:
> tbl <- matrix(c(
+ 20, 15, 16, 4,
+ 15, 7, 9, 4
+ ), ncol=4, byrow=TRUE)
> tbl
[,1] [,2] [,3] [,4]
[1,] 20 15 16 4
[2,] 15 7 9 4
> chisq.test(tbl)
Pearson's Chi-squared test
data: tbl
X-squared = 1.1981, df = 3, p-value = 0.7535
Warning message:
Chi-squared approximation may be incorrect in: chisq.test(tbl)