Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
saraloo committed Jul 26, 2024
1 parent d507ac1 commit a846b58
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions postprocessing/postprocess_snapshot.R
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,17 @@ if("hosp" %in% model_outputs){
# pdf(fname, width = 20, height = 18)
# pdf(fname)
fit_stats <- names(config$inference$statistics)
subpop_names <- unique(outputs_global$hosp %>% .[,subpop])

for(i in 1:length(fit_stats)){
statistics <- purrr::flatten(config$inference$statistics[i])
cols_sim <- c("date", statistics$sim_var, "subpop","slot")
cols_data <- c("date", "subpop", statistics$data_var)
hosp_outputs_global_tmp <- copy(outputs_global$hosp)[,..cols_sim]

# aggregate based on what is in the config
df_sim <- lapply(subpop_names, function(y) {
lapply(unique(hosp_outputs_global$slot), function(x)
lapply(unique(outputs_global$hosp$slot), function(x)
purrr::flatten_df(inference::getStats(
hosp_outputs_global_tmp %>% .[subpop == y & slot == x] ,
"date",
Expand Down Expand Up @@ -317,15 +319,14 @@ if("hosp" %in% model_outputs){
statistics <- purrr::flatten(config$inference$statistics[i])
cols_sim <- c("date", statistics$sim_var, "subpop","slot")
cols_data <- c("date", "subpop", statistics$data_var)
hosp_outputs_global_tmp <- hosp_outputs_global[,..cols_sim]

if("llik" %in% model_outputs){
# high_low_hosp_llik <- copy(outputs_global$hosp) %>%
# .[high_low_llik, on = c("slot", "subpop"), allow.cartesian = TRUE]

# aggregate simulation output and data by time based on what is in the config
df_sim <- lapply(subpop_names, function(y) {
lapply(unique(hosp_outputs_global$slot), function(x)
lapply(unique(outputs_global$hosp$slot), function(x)
purrr::flatten_df(inference::getStats(
hosp_outputs_global_tmp %>% .[subpop == y & slot == x] ,
"date",
Expand Down

0 comments on commit a846b58

Please sign in to comment.