||
> n <- 10
> x <- rnorm(n)
> y <- rnorm(n)
> cor(x,y)
[1] -0.4132864
> cor.test(x,y)
Pearson's product-moment correlation
data: x and y
t = -1.2837, df = 8, p-value = 0.2352
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
-0.8275666 0.2924366
sample estimates:
cor
-0.4132864
上面给出了相关系数的可信度区间和P-value
2 spearman相关系数和
kendall相关系数
同上,只要把method改成spearman和kendall
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-22 06:48
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社