Skip to content

Commit

Permalink
update so that waste calibration uses log-normal
Browse files Browse the repository at this point in the history
  • Loading branch information
mayaearn committed Jun 26, 2023
1 parent 75a589f commit c523ffe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions misc/experiments/calibration/calibration_ww.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ breakpoint_dates = c(ymd(20200310), ymd(20200330), ymd(20200419), ymd(20200608),
# start breakpoint times, so that calibration works,
# does not make sense to me at all
breakpoint_times = interval(ymd(20200310), breakpoint_dates) %/% days() + 1 + 120
breakpoint_times = c(20, 60, breakpoint_times)
breakpoint_times = c(25, 60, breakpoint_times)

# get macpan_base model with additional wastewater compartments
macpan_ww = Compartmental(file.path("../../../", "inst", "starter_models", "ww"))
Expand Down Expand Up @@ -202,7 +202,7 @@ simulator$insert$expressions(
(
# dnorm(
# log(obs_W), ## observed values
# log(clamp(rbind_time(simulated_W, obs_W_time_steps))), ## simulated values
# log(clamped_W), #log(clamp(rbind_time(simulated_W, obs_W_time_steps))), ## simulated values
# W_sd
# )
# dpois(
Expand Down Expand Up @@ -237,7 +237,7 @@ simulator$add$transformations(Log("beta_values"))
simulator$add$transformations(Log("xi"))
simulator$add$transformations(Log("nu"))
simulator$add$transformations(Log("mu"))
#simulator$add$transformations(Log("W_sd"))
simulator$add$transformations(Log("W_sd"))
#simulator$add$transformations(Log("H_sd"))
simulator$replace$params_frame(readr::read_csv("opt_parameters.csv", comment = "#"))
# simulator$replace$params(
Expand Down Expand Up @@ -265,9 +265,9 @@ simulator$optimization_history$get()


# create plot for hosp occ calibration which includes H, H2, ICUs, and ICUd
my_tib <- pivot_wider(filter(simulator$report(.phases = "during"),
matrix == "state",
row %in% c("H", "H2", "ICUd", "ICUs")),
my_tib <- pivot_wider(filter(simulator$report(.phases = "during"),
matrix == "state",
row %in% c("H", "H2", "ICUd", "ICUs")),
names_from = row) %>% mutate(sum = H + ICUs + ICUd + H2)

lines(1:(460+60), my_tib$sum, col = "red")
Expand Down
1 change: 1 addition & 0 deletions misc/experiments/calibration/opt_parameters.csv
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ log_beta_values,11, 0, -3.5
log_beta_values,12, 0, -3.5
log_beta_values,13, 0, -3.5
log_beta_values,14, 0, -3.5
log_W_sd, 0, 0, 1
log_xi, 0, 0, -3.5
log_nu, 0, 0, -3.5
log_mu, 0, 0, -3.5
Expand Down

0 comments on commit c523ffe

Please sign in to comment.