View source: R/test_consequences.R
test_consequences | R Documentation |
Test Consequences
test_consequences(
formula,
data,
statistics = c("pos_rate", "neg_rate", "test_pos_rate", "test_neg_rate", "tp_rate",
"fp_rate", "fn_rate", "tn_rate", "ppv", "npv", "sens", "spec", "lr_pos", "lr_neg"),
thresholds = seq(0, 1, by = 0.25),
label = NULL,
time = NULL,
prevalence = NULL
)
formula |
a formula with the outcome on the LHS and a sum of markers/covariates to test on the RHS |
data |
a data frame containing the variables in |
statistics |
Character vector with statistics to return. See below for details |
thresholds |
vector of threshold probabilities between 0 and 1.
Default is |
label |
named list of variable labels, e.g. |
time |
if outcome is survival, |
prevalence |
When |
a tibble with test consequences
The following diagnostic statistics are available to return.
Statistic | Abbreviation | Definition |
Outcome Positive Rate | "pos_rate" | (a + c) / (a + b + c + d) |
Outcome Negative Rate | "neg_rate" | (b + d) / (a + b + c + d) |
Test Positive Rate | "test_pos_rate" | (a + b) / (a + b + c + d) |
Test Negative Rate | "test_neg_rate" | (c + d) / (a + b + c + d) |
True Positive Rate | "tp_rate" | a / (a + b + c + d) |
False Positive Rate | "fp_rate" | b / (a + b + c + d) |
False Negative Rate | "fn_rate" | c / (a + b + c + d) |
True Negative Rate | "tn_rate" | d / (a + b + c + d) |
Positive Predictive Value | "ppv" | a / (a + b) |
Negative Predictive Value | "npv" | d / (c + d) |
Sensitivity | "sens" | a / (a + c) |
Specificity | "spec" | d / (b + d) |
Positive Likelihood Ratio | "lr_pos" | sens / (1 - spec) |
Negative Likelihood Ratio | "lr_neg" | (1 - sens) / spec |
test_consequences(cancer ~ cancerpredmarker, data = df_binary)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.