如何在R中建立不对称的相关性?

发布于 2025-01-26 05:33:18 字数 1007 浏览 2 评论 0原文

有时我曾经使用Psych :: Corr.test带有两个数据帧,例如:

df1 <- tibble(a=c(1,2,4,5,67,21,21,65,1,5), b=c(21,5,2,6,8,4,2,6,2,2))

df2 <- tibble(a=c(1,2,3,4,5,6,7,8,9,8), b=c(1,6,54,8,3,8,9,5,2,1), c=c(1,4,6,8,5,3,9,7,5,4))

corr <- corr.test(df1,df2, adjust = "BH")

我正在从corr $ p.adj获得p值。 但是有时候它给我带来了奇怪的重复性值,例如:

          a         b         c
a 0.5727443 0.5964993 0.5727443
b 0.2566757 0.5727443 0.2566757

有人知道这些p值有多足够吗?我们可以使用corr.test来执行此操作吗?如果没有,我该如何建立不对称的相关性?

我强调的是,如果我尝试执行对称相关性,就像

df <- bind_cols(df1,df2[-3])
corr <- corr.test(df, adjust = "BH")

它的p值不那么重复:

Probability values (Entries above the diagonal are adjusted for multiple tests.) 
      a...1 b...2 a...3 b...4
a...1  0.00  0.97  0.62  0.72
b...2  0.97  0.00  0.38  0.62
a...3  0.39  0.06  0.00  0.62
b...4  0.60  0.40  0.41  0.00

upd:好的:好吧,我意识到它和第一个一样重复,我有点愚蠢。

Sometimes I used to use psych::corr.test function with two data frames like:

df1 <- tibble(a=c(1,2,4,5,67,21,21,65,1,5), b=c(21,5,2,6,8,4,2,6,2,2))

df2 <- tibble(a=c(1,2,3,4,5,6,7,8,9,8), b=c(1,6,54,8,3,8,9,5,2,1), c=c(1,4,6,8,5,3,9,7,5,4))

corr <- corr.test(df1,df2, adjust = "BH")

And I was getting p-values from corr$p.adj
But sometimes it gives me strange repetitive p.values like:

          a         b         c
a 0.5727443 0.5964993 0.5727443
b 0.2566757 0.5727443 0.2566757

Does anyone know how adequate these p-values are? Can we do this with the corr.test? If not, how can I make an asymmetric correlation?

I'm stressed that if I try to perform symmetric correlation like

df <- bind_cols(df1,df2[-3])
corr <- corr.test(df, adjust = "BH")

it's p-values not so repetative:

Probability values (Entries above the diagonal are adjusted for multiple tests.) 
      a...1 b...2 a...3 b...4
a...1  0.00  0.97  0.62  0.72
b...2  0.97  0.00  0.38  0.62
a...3  0.39  0.06  0.00  0.62
b...4  0.60  0.40  0.41  0.00

UPD: Okay, I realised that it's as repetitive as the first and I'm a bit stupid.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

征﹌骨岁月お 2025-02-02 05:33:18

BH校正基于计算n/i * p的累积最小值,其中p具有您的n = 6未调整的P值按顺序减少,i6:1。 您可以在Psych :: P. adjust中看到计算。

( ,等等)可能会有重复。

The BH correction is based on computing the cumulative minimum of n/i * p, where the p has your n = 6 unadjusted p-values in decreasing order, and i is 6:1. (You can see the calculation in psych::p.adjust.)

Because it's a cumulative minimum (i.e. the first value, then the min of the first and second, then the min of the first to third, etc.) there are likely to be repetitions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文