A mistake in my False discovery rate (FDR) correction script

37 sec read

I have posted an FDR script at https://www.alivelearn.net/?p=1840. I noticed that there is a small bug. In rare cases, this bug will cause the most significant voxel to be classified as ‘non-significant’ while other voxels are ‘significant’.

Consider the following example:

p = [0.8147 0.9058 0.0030 0.9134 0.6324 0.0029 0.2785 0.5469 0.9575 0.9649 0.1576 0.9706 0.9572 0.4854 0.8003 0.1419 0.4218 0.9157];

The previous script will classify p(3) as significant but p(6) as non-significant.

Here is the updated version of the script:

function y = fdr0(p, q)
% y = fdr0(p, q)
%
% to calculate whether a pvalue survive FDR corrected q
%
% p: an array of p values. (e.g. p values for each channel)
% q: desired FDR threshold (typically 0.05)
% y: an array of the same size with p with only two possible values. 0
% means this position (channel) does not survive the threshold, 1 mean it
% survives
%
% Ref:
% Genovese et al. (2002). Thresholding statistical maps in functional
% neuroimaging using the false discovery rate. Neuroimage, 15:722-786.
%
% Example:
%   y = fdr0(rand(10,1),0.5);
%
% Xu Cui
% 2016/3/14
%

pvalue = p;
y = 0 * p;

[sortedpvalue, sortedposition] = sort(pvalue);
v = length(sortedposition);
for ii=1:v
    if q*ii/v >= sortedpvalue(ii)
        y(sortedposition(1:ii)) = 1;
    end
end

return;



文献鸟 618 大优惠


写作助手,把中式英语变成专业英文


AI writing papers with real references


Want to receive new post notification? 有新文章通知我

第七十二期fNIRS Journal Club通知2026/6/6, 10am 曹家铭博士

随着近年来深度学习在DOT/fNIRS重建中的应用,研究者往往需要大规模地生成仿真数据,高性能的仿真和处理软件则显得尤为重要。来自澳门大学的曹家铭教授将介绍一款针对DOT的高性能光子仿真Python包
Wanling Zhu
10 sec read

第七十一期fNIRS Journal Club视频 段海军团队

Youtube: https://youtu.be/lMuG2bY4pvs 优酷:https://v.youku.com/v_show/id_XNjUyODE0NzI3Ng==.html 尽管已有成瘾
Wanling Zhu
18 sec read

第七十一期fNIRS Journal Club通知2026/5/9, 10am 段海军团队

尽管已有成瘾研究对毒品渴求的神经生物学机制进行了深入探索,但反复毒品吸食与戒断发作对人类社会行为的影响迄今仍尚未明晰。陕西师范大学段海军课题组的王一凡将介绍他们结合fNIRS超扫描技术与人际互动范式,
Wanling Zhu
13 sec read

One Reply to “A mistake in my False discovery rate (FDR) correction…”

Leave a Reply

Your email address will not be published. Required fields are marked *