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通知2024/07/27, 10am 黄鑫

电子烟作为一种新型的尼古丁输送装置,常以安全健康、有助于戒烟的形象出现在公众视野中,使得大批消费者转而投入到此类产品的怀抱中。然而,相关研究却仍存较大短板,深入了解电子烟对行为与脑功能活动的影响将更好
Wanling Zhu
10 sec read

第五十三期fNIRS Journal Club视频 李洪

Youtube: https://youtu.be/czyJTrXhees优酷:https://v.youku.com/v_show/id_XNjQwNjc5OTk0OA==.html 个体在处理不同
Wanling Zhu
12 sec read

第五十三期fNIRS Journal Club通知2024/06/22, 10am 李洪

个体在处理不同记忆负荷信息时会表现出一定的行为差异。作为一项新兴指标,瞬时脑信号变异性能够揭示个体内部因任务需求不断变化而进行的神经资源分配,从而为了解大脑如何适应和处理不同复杂程度的信息提供了新的见
Wanling Zhu
8 sec read

Leave a Reply

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