FDR correction matlab script

40 sec read

The following script is to determine is a channel (or voxel) survives the FDR corrected threshold. Assume you have 48 channels and you already calculated the (uncorrected) p-value of each channel. You put it into an array called p. Now you want to know which channel will survive if you do a FDR correction at q=0.05. You may simply use

fdr0(p, 0.05)

The output is an array of 48 numbers, with 1s in the channel where it survives the FDR threshold.

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(ii)) = 1;
    end
end

return;



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


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

第六十七期fNIRS Journal Club通知2025/11/1, 10am 肖雅琼教授团队

近年来,越来越多的研究关注自闭症谱系障碍 (ASD)儿童的大脑功能连接异常。但这些异常连接在时间维度上如何变化?又是否与儿童的症状严重程度和认知能力有关?深圳理工大学的肖雅琼教授使用功能性近红外光谱
Wanling Zhu
13 sec read

第六十六期fNIRS Journal Club视频 李洪博士 牛海晶教授

Youtube: https://youtu.be/gkXdJkOalNY 优酷:https://v.youku.com/v_show/id_XNjUwMzg3MzQ2MA==.html 随着老龄化加
Wanling Zhu
13 sec read

fNIRS Frontier Weekly Report (free service)

Subscription Link: https://www.storkapp.me/readingguide/ If you are interested in the fNIRS (Functional Near-Infrared Spectroscopy) field, Stork is now offering a free service: every week, we will collect and summarize the fNIRS-related literature pu
Xu Cui
3 min read

Leave a Reply

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