例題:
「表 1 において,血液型と疾患に関連があるかどうか検定しなさい。」
| 血液型 | 胃潰瘍患者 | 胃癌患者 | 健康者 | 合計 |
|---|---|---|---|---|
| A 型 | 16 | 12 | 36 | 64 |
| B 型 | 12 | 5 | 20 | 37 |
| O 型 | 15 | 11 | 24 | 50 |
| AB 型 | 9 | 2 | 1 | 12 |
| 合計 | 52 | 30 | 81 | 163 |
R による解析:
> tbl5 <- matrix(c(
+ 16, 12, 36,
+ 12, 5, 20,
+ 15, 11, 24,
+ 9, 2, 1
+ ), ncol=3, byrow=TRUE)
> tbl5
[,1] [,2] [,3]
[1,] 16 12 36
[2,] 12 5 20
[3,] 15 11 24
[4,] 9 2 1
> chisq.test(tbl5)
Pearson's Chi-squared test
data: tbl5
X-squared = 13.7134, df = 6, p-value = 0.03301
Warning message:
Chi-squared approximation may be incorrect in: chisq.test(tbl5)