Skip to contents

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()
#> [1] "ConvertedToAlzheimers ~ PLASMA_ABETA_bl"
#> [1] "ConvertedToAlzheimers ~ PLASMA_PTAU181_bl"
#> [1] "ConvertedToAlzheimers ~ PLASMA_NFL_bl"
#> [1] "ConvertedToAlzheimers ~ PLASMA_ABETA_bl + PLASMA_PTAU181_bl + PLASMA_NFL_bl"
#> [1] "CSF_ABETA_STATUS_bl ~ PLASMA_ABETA_bl"
#> [1] "CSF_ABETA_STATUS_bl ~ PLASMA_PTAU181_bl"
#> [1] "CSF_ABETA_STATUS_bl ~ PLASMA_NFL_bl"
#> [1] "CSF_ABETA_STATUS_bl ~ PLASMA_ABETA_bl + PLASMA_PTAU181_bl + PLASMA_NFL_bl"

fig <- model %>% aba_plot_risk_density()