Skip to contents

This function creates a glm stat object which can be passed as input to the set_stats() function when building an aba model. This stat performs a traditional logistic regression analysis using the glm function with a binary outcome. Coefficients will be presented as odds ratios. Default metrics include AUC.

Usage

stat_glm(std.beta = FALSE, complete.cases = TRUE)

Arguments

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


data <- adnimerge %>% dplyr::filter(VISCODE == 'bl')

# fit glm model with binary outcome variables
model <- data %>% aba_model() %>%
  set_groups(everyone()) %>%
  set_outcomes(ConvertedToAlzheimers, CSF_ABETA_STATUS_bl) %>%
  set_predictors(
    PLASMA_PTAU181_bl, PLASMA_NFL_bl,
    c(PLASMA_PTAU181_bl, PLASMA_NFL_bl)
  ) %>%
  set_stats(
    stat_glm(std.beta = TRUE)
  ) %>%
  fit()
#> [1] "ConvertedToAlzheimers ~ PLASMA_PTAU181_bl"
#> [1] "ConvertedToAlzheimers ~ PLASMA_NFL_bl"
#> [1] "ConvertedToAlzheimers ~ PLASMA_PTAU181_bl + PLASMA_NFL_bl"
#> [1] "CSF_ABETA_STATUS_bl ~ PLASMA_PTAU181_bl"
#> [1] "CSF_ABETA_STATUS_bl ~ PLASMA_NFL_bl"
#> [1] "CSF_ABETA_STATUS_bl ~ PLASMA_PTAU181_bl + PLASMA_NFL_bl"

# summarise glm model
model_summary <- model %>% summary()

# plot glm results
fig1 <- model_summary %>% aba_plot_coef()
fig2 <- model_summary %>% aba_plot_metric()
fig3 <- model_summary %>% aba_plot_roc()