【问题标题】:psych::corr.p(): How can I round p-values to three decimals?psych::corr.p():如何将 p 值四舍五入到小数点后三位?
【发布时间】:2021-07-08 00:14:48
【问题描述】:

我想知道我的相关矩阵的 p 值四舍五入到小数点后三位并使用 Benjamini Hochberg 校正进行了调整。

为了这个目标,我尝试使用

psych::corr.p(as.matrix(cormatrix), n = 999, adjust = "BH")

但是,在这个函数中,p 值被四舍五入到小数点后两位

round(sych::corr.p(as.matrix(cormatrix), n = 99, adjust = "BH"), 3)

给我错误

数学函数的非数值参数

我想我可以使用p.adjust(pvector, method = "BH"), 3)。但是corr.test 只给了我以某种形式调整的 p 值,因此再次调整可能会导致 p 值被高估。

我不能简单地使用round(corr.test(), 3),它会给我调整后的 p 值和三位小数,因为在我的相关矩阵中是双变量相关以及我想同时调整 p 的偏相关。

【问题讨论】:

  • 将结果 corr.p 返回到一个对象并检查它。 cp <- psych::corr.p(as.matrix(cormatrix), n = 999, adjust = "BH") ; str(cp) 。您应该会看到一个对象列表 - 选择您想要round 的对象。另请注意帮助页面?psych::corr.p 提供了有关所有重新调整的值的详细信息
  • 感谢@user20650!这个小技巧很有帮助。

标签: r p-value psych


【解决方案1】:

round(corr.p(cormatrix, n = 999)$p, 3) 有效

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-14
    • 1970-01-01
    • 2017-03-26
    • 2012-01-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多