Skip to content

Function: computeFDRThreshold()

ts
function computeFDRThreshold(pValues, q): FDRResult;

Defined in: src/utils/statistics.ts:54

Computes FDR threshold using the Benjamini-Hochberg procedure.

Algorithm:

  1. Sort p-values in ascending order
  2. For each rank i (1-indexed): criticalValue = (i / V) * q
  3. Find the largest i where pValues[i] <= criticalValue
  4. All p-values <= this threshold survive

Time complexity: O(V log V) due to sorting Space complexity: O(V) for sorted indices

Parameters

pValues

Float32Array

Array of p-values (one per vertex)

q

number

False discovery rate (typically 0.05)

Returns

FDRResult

FDR result with threshold, mask, and surviving count

Throws

If q is not in (0, 1]

Released under the MIT License.