分别为您提供相关系数上下限的功能是什么? [英] What is the function that will provide you the lower and upper bounds of correlation coefficient separately?

查看:115
本文介绍了分别为您提供相关系数上下限的功能是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

m=c(1,2,5,4,6,8)
h=c(1,2,9,8,7,3)
cor(m,h)
#[1] 0.4093729

如果您估计相关性系数(R),那么您还可以估计相关系数(R)的 95%置信区间,例如,产生类似

If you estimate the correlation coefficient (R), then you can also estimate a 95% confidence interval for correlation coefficient (R), resulting in, for example something like

 R = 0.40  [0.33 0.56]

其中R的最佳估计是 0.40 ,并且真正的R介于 95%的机会 0.3 0.56 。 (请注意,这些数字已完全组成。)

where the "best" estimate for R is 0.40 and there's a 95% chance that the true R is between 0.3 and 0.56. (Note that these numbers are completely made up.)

我正在寻找一个函数,该函数将分别提供R的下限和上限。
具有以下内容:

I am looking for a function, which will provide the lower and upper bounds of R separately . To have something like:

 R = 0.40
upper  [0.33]
 lower [0.56] 

MATLAB 类似的东西:

         [R,P,RLO,RUP]=corrcoef(...) also returns matrices RLO and RUP, of the same size as R,            
         containing lower and upper bounds for a 95% confidence interval for each coefficient.


推荐答案

在<$ c的另请参见部分中$ c> cor 的帮助页面,显示为


cor.test进行置信区间(和测试)

cor.test for confidence intervals (and tests)



> cor.test(m, h)

    Pearson's product-moment correlation

data:  m and h
t = 0.8974, df = 4, p-value = 0.4202
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.6022868  0.9164582
sample estimates:
      cor 
0.4093729 

或者更直接地获得间隔:

Or to get at the interval more directly:

> x = cor.test(m, h)
> x$conf.int
[1] -0.6022868  0.9164582
attr(,"conf.level")
[1] 0.95

这篇关于分别为您提供相关系数上下限的功能是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆