calc_baseline_precision | R Documentation |
Calculate the fraction of positives, i.e. baseline precision for a PRC curve
calc_baseline_precision(dataset, outcome_colname = NULL, pos_outcome = NULL)
dataset |
Data frame with an outcome variable and other columns as features. |
outcome_colname |
Column name as a string of the outcome variable
(default |
pos_outcome |
the positive outcome from |
the baseline precision based on the fraction of positives
Kelly Sovacool, sovacool@umich.edu
# calculate the baseline precision
data.frame(y = c("a", "b", "a", "b")) %>%
calc_baseline_precision(
outcome_colname = "y",
pos_outcome = "a"
)
calc_baseline_precision(otu_mini_bin,
outcome_colname = "dx",
pos_outcome = "cancer"
)
# if you're not sure which outcome was used as the 'positive' outcome during
# model training, you can access it from the trained model and pass it along:
calc_baseline_precision(otu_mini_bin,
outcome_colname = "dx",
pos_outcome = otu_mini_bin_results_glmnet$trained_model$levels[1]
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.