pval_infl: Calculate inflation factor from p-values

View source: R/pval_infl.R

pval_inflR Documentation

Calculate inflation factor from p-values

Description

The inflation factor is defined as the median association test statistic divided by the expected median under the null hypothesis, which is typically assumed to have a chi-squared distribution. This function takes a p-value distribution and maps its median back to the chi-squared value (using the quantile function) in order to compute the inflation factor in the chi-squared scale. The full p-value distribution (a mix of null and alternative cases) is used to calculate the desired median value (the true causal_loci is not needed, unlike pval_srmsd()).

Usage

pval_infl(pvals, df = 1)

Arguments

pvals

The vector of association p-values to analyze. This function assumes all p-values are provided (a mix of null and alternative tests). NA values are allowed in input and removed. Non-NA values outside of [0, 1] will trigger an error.

df

The degrees of freedom of the assumed chi-squared distribution (default 1).

Value

The inflation factor

See Also

pval_srmsd(), a more robust measure of null p-value accuracy, but which requires knowing the true causal loci.

pval_type_1_err() for classical type I error rate estimates.

Examples

# simulate truly null p-values, which should be uniform
pvals <- runif(10)
# calculate desired measure
pval_infl( pvals )


OchoaLab/simtrait documentation built on April 19, 2024, 7:36 p.m.