[icon4.gif] [icon0.gif] [icon5.gif] 67. 相関係数と無相関検定 __________________________________________________________________ [icon2.gif] 相関係数と無相関検定 以下のような 2 組のデータ x ,y に相関があるかどうかの検定を行う場合は関数 cor.test() を使う. x <- c(70, 72, 62, 64, 71, 76, 60, 65, 74, 72) y <- c(70, 74, 65, 68, 72, 74, 61, 66, 76, 75) このとき,引数 method に次の文字列を入れることで検定方法を代えることが出来る. "pearson" : ピアソンの積率相関係数の無相関検定を行う. "kendall" : ケンドールの順位相関係数の無相関検定を行う. "spearman" : スピアマンの順位相関係数の無相関検定を行う. 上のデータ形式それぞれの入力例である. cor(x, y, method="spearman") # 単なる相関係数 [1] 0.929878 cor.test(x, y, method="pearson") # 無相関かどうかの検定 Pearson's product-moment correlation data: x and y t = 8.5685, df = 8, p-value = 2.656e-05 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: 0.7957471 0.9883181 sample estimates: cor 0.9496011 [icon4.gif] [icon0.gif] [icon5.gif]