This function creates a roc stat object which can be passed as input
to the set_stats()
function when building an aba model. This stat performs
a traditional ROC / cutpoint analysis from a binary outcome using the
optimal.cutpoints
function from the OptimalCutpoints
package. Note that
outcomes for this model should be binary and coded as 0 = healthy and
1 = disease.
Coefficients will be presented as the optimal cutpoint for the model derived
from Youden's index (or whatever method is specified).
Default metrics include AUC.
Arguments
- direction
'<' or '>. Which direction to interpret as being further from the healthy value. '<' is the default value and is interpreted as increasing predictor values are worse. '>' is therefore interpreted as higher predictor values are closer to healthy (outcome value of 0).
- method
string. Which method to use to calculate the optimal cutoff value. See the
OptimalCutpoints::optimal.cutpoints
function for more info.- std.beta
logical. Whether to standardize model predictors and covariates prior to analysis.
- complete.cases
logical. Whether to only include the subset of data with no missing data for any of the outcomes, predictors, or covariates. Note that complete cases are considering within each group - outcome combination but across all predictor sets.
Examples
data <- adnimerge %>% dplyr::filter(VISCODE == 'bl')
# fit a roc model to predict a binary outcome
model <- data %>% aba_model() %>%
set_groups(
everyone(),
DX_bl %in% c('MCI', 'AD')
) %>%
set_outcomes(CSF_ABETA_STATUS_bl) %>%
set_predictors(PLASMA_PTAU181_bl, PLASMA_NFL_bl) %>%
set_stats(
stat_roc(method='Youden')
) %>%
fit()
# summarise model
model_summary <- model %>% summary()
# if using predictors where higher values are better, then flip direction
model2 <- model %>%
set_predictors(PLASMA_ABETA_bl) %>%
set_stats(
stat_roc(direction = '>')
) %>%
fit()
model2_summary <- model2 %>% aba_summary()