pval_srmsd {simtrait} | R Documentation |
Signed RMSD measure of null p-value uniformity
Description
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).
Usage
pval_srmsd(pvals, causal_indexes, detailed = FALSE)
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).
|
causal_indexes |
The vector of causal indexes, whose p-values will be omitted.
Values of |
detailed |
If |
Value
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 wereNA
, these have been removed here (removed bysort()
). -
pvals_unif
: Expected order statistics assuming uniform distribution, same length aspvals_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.
See Also
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.
Examples
# 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 )