pval_gc | R Documentation |
Genomic control (GC) is a procedure designed to correct the calibration of p-values calculated from test statistics that are supposed to have a Chi-squared distribution but are misspecified and have a different median than desired, in which case the test statistics are divided by the inflation factor (the ratio between the observed and desired medians). This function applies the correction using p-values only, calculating the underlying test statistics assuming they are Chi-squared ditributed with known degrees of freedom. The function guarantees that the corrected p-values have a median of 0.5, as desired if they were calibrated, but otherwise there is no guarantee that these corrected p-values will have a reasonable distribution.
pval_gc(pvals, df = 1)
pvals |
The vector of association p-values to analyze.
This function assumes all p-values are provided (a mix of null and alternative tests).
|
df |
The degrees of freedom of the assumed chi-squared distribution (default 1). |
A list with the following named elements:
pvals
: the vector of GC-corrected p-values
lambda
: the inflation factor of the input p-values, which was used to calculate the corrected p-values
pval_infl()
, which is used internally to calculate the inflation factor.
# a simulated set of highly inflated p-values, skewed toward zero
pvals <- rbeta( 100, 1, 10 )
hist( pvals )
# calculate the GC-corrected p-values
obj <- pval_gc( pvals )
pvals2 <- obj$pvals
# and get the inflation factor of the original data:
obj$lambda
# note GC-corrected p-values are often not uniform:
hist( pvals2 )
# but they have a median of 0.5
median( pvals2 )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.