2
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%、たとえば次のようになります。

 R = 0.40  [0.33 0.56]

ここで、R の「最良の」推定値は0.40であり95%、真の R が ~ の間にある可能性が0.3あり0.56ます。(これらの数字は完全に構成されていることに注意してください。)

R の下限と上限を別々に提供する関数を探しています。次のようなものにする:

 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.
4

1 に答える 1

5

corのヘルプ ページの「関連項目」セクションには、次のように書かれています。

信頼区間 (およびテスト) の cor.test

> 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 

または、間隔をより直接的に取得するには:

> x = cor.test(m, h)
> x$conf.int
[1] -0.6022868  0.9164582
attr(,"conf.level")
[1] 0.95
于 2013-07-23T11:37:28.690 に答える