例題:
2変数 x, y について,10 組の測定値がある。x,y の間に相関はあるか。
| x | 9.7 | 10.3 | 9.6 | 7.7 | 10.2 | 10.6 | 10.4 | 11.4 | 7.8 | 8.6 |
|---|---|---|---|---|---|---|---|---|---|---|
| y | 9.9 | 10.9 | 9.4 | 11.4 | 10.1 | 8.4 | 10.4 | 11.4 | 9.0 | 9.6 |
R による解析:
> x <- c(9.7, 10.3, 9.6, 7.7, 10.2, 10.6, 10.4, 11.4, 7.8, 8.6)
> y <- c(9.9, 10.9, 9.4, 11.4, 10.1, 8.4, 10.4, 11.4, 9.0, 9.6)
> cor.test(x, y, method="pearson")
Pearson's product-moment correlation
data: x and y
t = 0.3736, df = 8, p-value = 0.7184
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
-0.5434819 0.7026470
sample estimates:
cor
0.1309564