【发布时间】:2020-12-22 19:04:54
【问题描述】:
我有两个相关向量:一个表示真实相关,另一个表示置换相关(零分布)。我想找到对应于 0.05 的 FDR 的相关值。
更新方法:
cor_real=rnorm(1000,0,sd=0.2)
cor_null=rnorm(1000,0,sd=0.15)
d_real=density(cor_real,from=max(min(cor_real),min(cor_null)),to=min(max(cor_real),max(cor_null)))
d_null=density(cor_null,from=max(min(cor_real),min(cor_null)),to=min(max(cor_real),max(cor_null)))
# here we ensure that the x values are comparable between the two densities
plot(d_real)
lines(d_null)
那么,要找到对应于 FDR = 0.05 的相关值,我的猜测是:
ratios=d_null$y/d_real$y
d_real$x[which(round(ratios,2)==.05)]
[1] 0.5694628 0.5716372 0.5868581 0.5890325 0.5912069
# this the the correlation value(s) that corresponds to a 5% chance of a false positive
这是正确的方法吗?
例如:
cor_real=rnorm(100,0.25,sd=0.1)
cor_null=rnorm(100,0.2,sd=0.1)
h_real=hist(cor_real,plot=F)
h_null=hist(cor_null,plot=F)
plot(h_null,col=rgb(1,0,0,.5),xlim=c(0,1),ylim=c(0,max(h_real$counts))) # in red
plot(h_real,col=rgb(0,.5,.5,0.25),add=T) # in blue
我认为这是两个直方图的频率之比 = 0.05 (null:real),但我对此不是 100% 确定。
我如何找到对应于 FDR = 0.05 的相关值,同时“访问”空分布和真实分布?
【问题讨论】:
-
请阅读r 标签页顶部关于如何提问的信息。特别是请提供一个可重现的例子。
-
很公平,但我没有提供可重现的示例,因为我不确定如何开始操作。
-
好吧,您至少可以提供两个相关向量,以明确您的输入数据是什么样的。我不确定你说的是什么比例。这里的分子和分母是什么。如果您没有数据或代码,最好在 Cross Validated 上询问有关主题的纯统计问题。
-
了解,已更新。
-
您使用的是绝对频率直方图,当您要查找的值是相对的,因为它是 FDR= 0.05;您可以将
h_real和h_null从绝对频率直方图更改为相对频率直方图,然后就可以得到 h_real 和 h_null 相同的 cor_null 值...
标签: r distribution fdr