def get_fdr_thresh(p_values, power):
"""
Calculate the false discovery rate threshold.
:param p_values: a list of p-values obtained by executing the regression
:param power: the thershold power being used (usually 0.05)
:type p_values: numpy array
:type power: float
:returns: the false discovery rate
:rtype: float
"""
sn = np.sort(p_values)
sn = sn[np.isfinite(sn)]
sn = sn[::-1]
for i in range(len(sn)):
thresh = 0.05 * i / len(sn)
if sn[i] <= power:
break
return sn[i]
评论列表
文章目录