This function calculates the false discovery rate (FDR) by comparing observed values to permuted values.The function sorts observed values, compares them against permuted data, and computes FDR using the median of permutation results.

calculateFalseDiscoveryRate(observedValues, permutedValues)

Arguments

observedValues

Numeric vector. The observed test statistics or values to be evaluated for significance.

permutedValues

Numeric matrix. The permuted test statistics or values, with rows corresponding to the same values as in observedValues and columns representing different permutations.

Value

A numeric vector of the same length as observedValues, containing the estimated FDR for each observed value.