【问题标题】:Different P-values using cor.test and rcorr使用 cor.test 和 rcorr 的不同 P 值
【发布时间】:2019-09-19 13:46:30
【问题描述】:

在使用 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

【问题讨论】:

  • 我认为这些 cor 方法中的任何一个都不会调整 p 值,因此差异可能是由于处理缺失数据的方式——尽管相关性是相同的。如果您像处理cor.test 一样一次进行一项相关性计算,rcorr 的比较结果如何? (ps 一些奇怪的 cor.test pvalues 格式)
  • ...实际上我无法重现您使用缺失数据看到的差异。你能提供一个数据样本,你可以复制吗?
  • rcorr 在 ... 中是什么包? Hmisc ?请给我们minimal reproducible example 好吗?

标签: r correlation


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-19
    • 1970-01-01
    • 1970-01-01
    • 2015-05-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多