forked from cab79/Matlab_files
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFDR.m
More file actions
25 lines (20 loc) · 604 Bytes
/
FDR.m
File metadata and controls
25 lines (20 loc) · 604 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function [pID,pN] = FDR(p,q)
% FORMAT [pID,pN] = FDR(p,q)
%
% p - vector of p-values
% q - False Discovery Rate level
%
% pID - p-value threshold based on independence or positive dependence
% pN - Nonparametric p-value threshold
%______________________________________________________________________________
% $Id: FDR.m,v 2.1 2010/08/05 14:34:19 nichols Exp $
p = p(isfinite(p)); % Toss NaN's
p = sort(p(:));
V = length(p);
I = (1:V)';
cVID = 1;
cVN = sum(1./(1:V));
pID = p(max(find(p<=I/V*q/cVID)));
if isempty(pID), pID=0; end
pN = p(max(find(p<=I/V*q/cVN)));
if isempty(pN), pN=0; end