Skip to main content
. Author manuscript; available in PMC: 2008 Nov 17.
Published in final edited form as: Stat Sin. 2008;18(3):881–904.

Algorithm 1.

Resampling algorithm for computing FDR adjusted p values by using the test statistics only

Compute the test statistic ti, i = 1, · · ·, m on the observed data matrix x and, without loss of generality, label them |t1| ≥··· ≥ |tm|.
For the b-th step, b = 1, …, B, proceed as follows.
  1. Compute the resampled data matrix xb, for example by randomly permuting the columns of matrix x.

  2. Compute the test statistic ti,b for hypothesis Hi, i = 1, ···, m on the data matrix xb.

  3. For each i = 1, …, m, mimic the step-down procedure:

    1. for j = 1, …, mi + 1, let t(j)i,b be the j-th largest member of {ti,b, …, tm,b} in absolute value;

    2. define Ri,b to be the unique integer k such that

      t(1)i,bti,,t(k)i,bti+k1andt(k+1)i,b<ti+k.
  4. Compute f1,b = I(R1,b > 0) and, for i = 2, …, m, compute fi,b = Ri,b/(Ri,b+i− 1).


Steps 1–4 are carried out B times and the adjusted p-values are estimated by pˇi=b=1Bfi,b/B, with monotonicity enforced by setting
p1pˇ1,pimax(pi1,pˇi)fori=2,m.