| pval_aucpr {simtrait} | R Documentation |
Area under the precision-recall curve
Description
Calculates the Precision-Recall (PR) Area Under the Curve (AUC) given a vector of p-values and the true classes (causal (alternative) vs non-causal (null)).
This is a wrapper around PRROC::pr.curve(), which actually calculates the AUC (see that for details).
Usage
pval_aucpr(pvals, causal_indexes, curve = FALSE)
Arguments
pvals |
The vector of association p-values to analyze.
|
causal_indexes |
The vector of causal indexes, defining the true classes used for AUC calculation.
Values of |
curve |
If |
Value
If curve = FALSE, returns the PR AUC scalar value.
If curve = TRUE, returns the PRROC object as returned by PRROC::pr.curve(), which can be plotted directly, and which contains the AUC under the named value auc.integral.
However, 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.
See Also
PRROC::pr.curve(), which is used internally by this function.
pval_power_calib() for calibrated power estimates.
Examples
# simulate truly null p-values, which should be uniform
pvals <- runif(10)
# for toy example, take the first two p-values to be truly causal
causal_indexes <- 1:2
# calculate desired measure
pval_aucpr( pvals, causal_indexes )