pval_srmsd | R Documentation |
Quantifies null p-value uniformity by computing the RMSD (root mean square deviation) between the sorted observed null (truly non-causal) p-values and their expected quantiles under a uniform distribution.
Meant as a more robust alternative to the "inflation factor" common in the GWAS literature, which compares median values only and uses all p-values (not just null p-values).
Our signed RMSD, to correspond with the inflation factor, includes a sign that depends on the median null p-value:
positive if this median is <= 0.5
(corresponds with test statistic inflation), negative otherwise (test statistic deflation).
Zero corresponds to uniform null p-values, which arises in expectation only if test statistics have their assumed null distribution (there is no misspecification, including inflation).
pval_srmsd(pvals, causal_indexes, detailed = FALSE)
pvals |
The vector of association p-values to analyze.
This function assumes all p-values are provided (a mix of null and alternative tests).
|
causal_indexes |
The vector of causal indexes, whose p-values will be omitted.
Values of |
detailed |
If |
If detailed
is FALSE
, returns the signed RMSD between the observed p-value order statistics and their expectation under true uniformity.
If detailed
is TRUE
, returns data useful for plots, a named list containing:
srmsd
: The signed RMSD between the observed p-value order statistics and their expectation under true uniformity.
pvals_null
: Sorted null p-values (observed order statistics). If any input null p-values were NA
, these have been removed here (removed by sort()
).
pvals_unif
: Expected order statistics assuming uniform distribution, same length as pvals_null
.
If the input pvals
is NULL
(taken for case of singular association test, which is rare but may happen), then the returned value is NA
if detailed
was FALSE
, or otherwise the list contains NA
, NULL
and NULL
for the above three items.
rmsd()
for the generic root-mean-square deviation function.
pval_infl()
for the more traditional inflation factor, which focuses on the median of the full distribution (combination of causal and null cases).
pval_type_1_err()
for classical type I error rate estimates.
# simulate truly null p-values, which should be uniform
pvals <- runif(10)
# for toy example, take the first p-value to be truly causal (will be ignored below)
causal_indexes <- 1
# calculate desired measure
pval_srmsd( pvals, causal_indexes )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.