function pk = FDR(p,alpha)
%Critical p-value p_(k) for FDR <= alpha.

m = length(p);  %number of hypotheses
po = sort(p(:));   %ordered p-values
i = (1:m)';        %index
pk = po(max(find(  po < i./m * alpha)));
  %critical p-value.
if ( isempty(pk)==1 )
    pk=0;
end
