aba_plot_risk_density: Plot risk density split by binary outcome class

View source: R/stat_glm.R

aba_plot_risk_densityR Documentation

Plot risk density split by binary outcome class

Description

This function plots risk density curves across group - outcome - stat combinations and split by binary outcome. It currently supports stat_glm.

Usage

aba_plot_risk_density(
  model,
  risk_type = c("absolute", "relative"),
  drop_basic = FALSE
)

Arguments

model

abaModel. A fitted aba model with stat_glm type.

risk_type

string. Whether to use absolute or relative risk.

drop_basic

logical. Whether to drop the basic model or not.

Value

a ggplot with risk density curves split by binary outcome value.

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_ABETA_bl, PLASMA_PTAU181_bl, PLASMA_NFL_bl,
    c(PLASMA_ABETA_bl, PLASMA_PTAU181_bl, PLASMA_NFL_bl)
  ) %>%
  set_stats(
    stat_glm(std.beta = TRUE)
  ) %>%
  fit()

fig <- model %>% aba_plot_risk_density()

ncullen93/abaR documentation built on Feb. 8, 2024, 12:01 p.m.