例題:
「10 人の被検者について,五段階評価をした。同じ被検者に対して,1 年後にもう一度評価した。その結果を表に示す。1 年間で母代表値に差があったかどうか検定しなさい。」
| 被験者 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|
| $X_i$ | A | A | C | B | D | A | C | B | D | B |
| $Y_i$ | C | A | E | D | B | B | D | A | E | D |
| $X_i-Y_i$ | + | 0 | + | + | − | + | + | − | + | + |
R による解析:
> x <- c(1,1,3,2,4,1,3,2,4,2) # A 〜 E を 1 〜 5 とする。
> y <- c(3,1,5,4,2,2,4,1,5,4)
> binom.test(c(length(x[x > y]), length(x[x < y])))
Exact binomial test
data: 2 and 9
number of successes = 2, number of trials = 9, p-value = 0.1797
alternative hypothesis: true probability of success is not equal to 0.5
95 percent confidence interval:
0.02814497 0.60009357
sample estimates:
probability of success
0.2222222