The genomic-control inflation factor \(\lambda_{\mathrm{GC}} = \mathrm{median}(\chi^2) / \mathrm{qchisq}(0.5, 1)\), with the chi-squares recovered from the p-values as \(\mathrm{qchisq}(1-p, 1)\).

compute_lambda_gc(pvalues)

Arguments

pvalues

Numeric vector of p-values.

Value

The inflation factor (numeric scalar), or NA_real_ when there are fewer than 50 usable p-values.

Details

Only finite p-values in \((0, 1]\) are used. Returns NA when fewer than 50 such values are available (too few to interpret).

Examples

set.seed(1)
compute_lambda_gc(pchisq(rchisq(2000, 1) * 1.2, 1, lower.tail = FALSE))  # ~1.2
#> [1] 1.227634