# 2変量の散布図
png('test3.png')
plot(cars)
dev.off()
# 相関係数Rを求める
r = cor(cars$speed, cars$dist)
r
# 相関かどうかの検定
cor.test(cars$speed, cars$dist)
実行結果
$ Rscript test3.R
null device
1
[1] 0.8068949
Pearson's product-moment correlation
data: cars$speed and cars$dist
t = 9.464, df = 48, p-value = 1.49e-12
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.6816422 0.8862036
sample estimates:
cor
0.8068949
Pearson's product-moment correlationの内容
Parameter | Description |
df | Degrees of Freedom |
p-value | p値 |
95 percent confidence interval | 95%信頼区間 |
出力結果
0 件のコメント:
コメントを投稿