Skip to content

Commit

Permalink
add supp fig, add asterisk to fig4 (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaitejohnson authored Dec 15, 2024
1 parent 7a9d73f commit 89614c6
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
9 changes: 9 additions & 0 deletions _targets_eval_postprocessing.R
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,15 @@ hub_comparison_plots <- list(
time_period = "Oct 2023-Mar 2024"
)
),
tar_target(
name = sfig5_plot_wis_t_all_time,
command = make_fig5_average_wis(
all_scores = summarized_scores_oct_mar,
models_to_show = unique(combine_scores_oct_mar$model),
time_period = "Oct 2023-Mar 2024",
fig_file_dir = eval_config$ms_fig_dir
)
),
tar_target(
name = fig5_overall_performance,
command = make_fig5_hub_performance(
Expand Down
2 changes: 1 addition & 1 deletion wweval/R/ms_fig4.R
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ make_fig4_avg_wis_over_time <- function(wis_scores,
dplyr::mutate(
model = case_when(
model == "ww" ~ "cfa-wwrenewal(real-time)",
model == "hosp" ~ "cfa-hosponlyrenewal(real-time)"
model == "hosp" ~ "cfa-hosponlyrenewal(real-time)*"
)
)

Expand Down
15 changes: 14 additions & 1 deletion wweval/R/ms_fig5.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ make_fig5_bar_chart <- function(scores,
#' @param horizon_time_in_weeks horizon time in weeks to summarize over, default
#' is `NULL` which means that the scores are summarized over the nowcast period
#' and the 4 week forecast period
#' @param fig_file_dir string indicating where to save fig, default is NULL
#'
#' @return a ggplot object of WIS scores over time colored by model, for the
#' real-time cfa model from Feb - Mar and the retrospective CFA model over
Expand All @@ -115,7 +116,8 @@ make_fig5_average_wis <- function(all_scores,
cfa_real_time_scores = c(),
models_to_show,
time_period,
horizon_time_in_weeks = NULL) {
horizon_time_in_weeks = NULL,
fig_file_dir = NULL) {
subset_model_scores <- all_scores |>
dplyr::filter(model %in% !!models_to_show)

Expand Down Expand Up @@ -177,6 +179,17 @@ make_fig5_average_wis <- function(all_scores,
legend.text = element_text(size = 7)
)

if (!is.null(fig_file_dir)) {
p <- p + guides(color = guide_legend(nrow = 3))
ggsave(p,
height = 6, width = 11,
filename = file.path(
fig_file_dir,
glue::glue("sfig_wis_over_time_all_models.png")
)
)
}

return(p)
}

Expand Down
5 changes: 4 additions & 1 deletion wweval/man/make_fig5_average_wis.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 89614c6

Please sign in to comment.