aba_plot_metric | R Documentation |
Plot metrics of an aba model summary
aba_plot_metric(
model_summary,
metric = NULL,
axis = c("predictor", "outcome", "group"),
coord_flip = FALSE,
include_basic = TRUE,
sort = FALSE,
facet_labels = TRUE,
palette = "jama",
plotly = FALSE
)
model_summary |
an aba model summary. The object to plot - this should be the
result of an |
metric |
string. The metric to plot. |
axis |
string. Specifies the x axis variable, color/fill variable, and facet variable in that order. Should be a vector of length three that includes only "predictor", "outcome", and "group" as values. |
coord_flip |
logical. Whether to flip the x and y axes. This can be useful when there are a large amount of predictor sets and you want to view metrics vertically. |
include_basic |
logical. Whether to include basic predictor. |
sort |
logical. Whether to sort axis labels by metric value |
facet_labels |
logical. Whether to include facet labels or not. |
palette |
string. Which ggpubr palette to use. See |
plotly |
logical. Whether to use plot.ly instead of standard ggplot. Defaults to false. Using ggplotly can be useful if you want interactivity on web pages. |
a ggplot of the specified aba model summary metric.
# fit aba model
model <- aba_model() %>%
set_data(adnimerge %>% dplyr::filter(VISCODE == 'bl')) %>%
set_groups(everyone()) %>%
set_outcomes(ConvertedToAlzheimers, CSF_ABETA_STATUS_bl,
.labels=c('Conversion to AD', 'CSF Abeta Status')) %>%
set_predictors(
PLASMA_ABETA_bl, PLASMA_PTAU181_bl, PLASMA_NFL_bl,
c(PLASMA_ABETA_bl, PLASMA_PTAU181_bl, PLASMA_NFL_bl),
.labels = c('A','T','N','ATN')
) %>%
set_stats(stat_glm(std.beta=TRUE)) %>%
fit()
# summarise aba model to calculate metrics
model_summary <- model %>% aba_summary()
# plot the metrics using default (defaults to AUC)
metric_plot <- model_summary %>% aba_plot_metric()
# coord flip
metric_plot2 <- model_summary %>% aba_plot_metric(coord_flip=TRUE)
# compare predictor sets within each outcome instead of the opposite
metric_plot3 <- model_summary %>%
aba_plot_metric(axis = c('outcome','predictor', 'group'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.