首页 > 解决方案 > 使用 cor.test 和 rcorr 的不同 P 值

问题描述

在使用 cor.test() 和 rcorr 比较结果时,有人可以帮助解释为什么 P 值不同吗?显着性水平变化很大。我应该报告/信任哪些结果?

先感谢您。

/丁

##########################################################################################################

> ### ONE CORRELATION AT THE TIME 
> ### CORRELATIONS WITH NEGATIVE AFFECTIVITY
> cor.test(dat$na_pid,dat$detach_pid) ### Significant

    Pearson's product-moment correlation

data:  dat$na_pid and dat$detach_pid
t = 16.206, df = 1780, p-value < 0.00000000000000022
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.3174279 0.3983797
sample estimates:
      cor 
0.3585777 

> cor.test(dat$na_pid,dat$antag_pid) ### Significant

    Pearson's product-moment correlation

data:  dat$na_pid and dat$antag_pid
t = 8.744, df = 1780, p-value < 0.00000000000000022
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.1579925 0.2470461
sample estimates:
      cor 
0.2029389 

> cor.test(dat$na_pid,dat$disin_pid) ### Significant

    Pearson's product-moment correlation

data:  dat$na_pid and dat$disin_pid
t = 11.775, df = 1780, p-value < 0.00000000000000022
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.2251995 0.3113720
sample estimates:
      cor 
0.2688236 

> cor.test(dat$na_pid,dat$psycho_pid) ### Significant

    Pearson's product-moment correlation

data:  dat$na_pid and dat$psycho_pid
t = 22.134, df = 1780, p-value < 0.00000000000000022
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.4273650 0.5002246
sample estimates:
      cor 
0.4645807 

> cor.test(dat$na_pid,dat$pid_total) ### Significant

    Pearson's product-moment correlation

data:  dat$na_pid and dat$pid_total
t = 36.247, df = 1780, p-value < 0.00000000000000022
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.6241087 0.6775899
sample estimates:
      cor 
0.6516584 

> cor.test(dat$na_pid,dat$mean_negaff) ### Significant

    Pearson's product-moment correlation

data:  dat$na_pid and dat$mean_negaff
t = 10.68, df = 1780, p-value < 0.00000000000000022
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.2012531 0.2885424
sample estimates:
      cor 
0.2453951 

> cor.test(dat$na_pid,dat$mean_posaff) ### Significant

    Pearson's product-moment correlation

data:  dat$na_pid and dat$mean_posaff
t = -9.6417, df = 1780, p-value < 0.00000000000000022
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.2664647 -0.1781943
sample estimates:
       cor 
-0.2227861 

> cor.test(dat$na_pid,dat$log.negaff_MSSD) ### Significant

    Pearson's product-moment correlation

data:  dat$na_pid and dat$log.negaff_MSSD
t = 6.6581, df = 1780, p-value = 0.00000000003684
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.1102457 0.2008643
sample estimates:
     cor 
0.155883 

> cor.test(dat$na_pid,dat$log.posaff_MSSD) ### Significant

    Pearson's product-moment correlation

data:  dat$na_pid and dat$log.posaff_MSSD
t = 4.563, df = 1780, p-value = 0.000005388
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.06139719 0.15319620
sample estimates:
      cor 
0.1075259 


RESULTS USING RCORR (MATRIX OF CORRELATIONS - results reported below are limited to correlations with dat$na_pid)

mycor <- rcorr(as.matrix(x), type="pearson")    

            na_pid  

detach_pid  0,36**
antag_pid   0,2 ns
disin_pid   0,27*
psycho_pid  0,46***
pid_total   0,65***
mean_negaff 0,25*
mean_posaff -0,22*
log.negaff_MSSD 0,16 ns 
log.posaff_MSSD 0,11 ns

标签: rcorrelation

解决方案


我遇到了同样的问题,在使用 spearman 方法时,在 cor.test() 函数中将参数“exact=FALSE”转为与 rcorr() 中完全相同的 p 值

来自 ?cor.test() 的精确
逻辑指示是否应计算精确的 p 值。用于 Kendall 的 tau 和 Spearman 的 rho。有关 NULL(默认值)的含义,请参见“详细信息”。


推荐阅读