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;


Receive email notification via email 博客有新内容通知我

Don't want to miss new papers in your field? Check out Stork we developed:

第二十六期 fNIRS Journal Club 视频

来自上海精神卫生中心的胡志善博士为大家介绍了一篇他们去年发表的综述(静息态近红外在研究发育的应用)。视频如下: Youtube:https://youtu.be/C7xIRrBUhhg Youku: https://v.youku.com/v_show/id_XNTgzNTQ5ODg3Mg==.html
Xu Cui
4 sec read

第二十六期 fNIRS Journal Club 通知 2022/1/15,10:00am

来自上海精神卫生中心的胡志善博士将为大家介绍具体一篇他们去年发表的综述(静息态近红外在研究发育的应用)。热烈欢迎大家参与讨论。 时间: 北京时间2022年1月15日上午10:00地点: https://zoom.com房间号: 897 8179 5073密码: 333858 胡博士要讲解的文章如下: Hu, Liu, Dong, Niu (2020) Applications of Resting-State fNIRS in the Developing Brain: A Review...
Xu Cui
6 sec read

第二十五期 fNIRS Journal Club 视频

来自华东师范大学的胡银莹博士为大家介绍了具体如何计算和验证超扫描实验中脑间同步性,并分享做fNIRS实验相关方面的应用经验。视频如下: Youtube:https://youtu.be/xI_6wKd06io Youku:上传后被youku屏蔽,原因不详。
Xu Cui
3 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 *