stat_roc: Create a roc stat object.

Description Usage Arguments Value Examples

View source: R/stat_roc.R

Description

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.

Usage

1
2
3
4
5
6
stat_roc(
  direction = "<",
  method = "Youden",
  std.beta = FALSE,
  complete.cases = TRUE
)

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.

Value

An abaStat object with glm stat type.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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()

aba documentation built on Dec. 17, 2021, 1:06 a.m.