From bc43c4b7d5b148ecc8a183f984891287d14ce133 Mon Sep 17 00:00:00 2001 From: ruthmccabe Date: Sat, 14 Dec 2024 18:22:23 +0000 Subject: [PATCH 01/19] changed CSW label to adult in get_group_bins --- R/parameters.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/parameters.R b/R/parameters.R index 54f7f86..f7ee574 100644 --- a/R/parameters.R +++ b/R/parameters.R @@ -260,7 +260,7 @@ get_group_bins <- function() { groups <- data.frame(label = c("CSW", "ASW", "PBS", "HCW"), start = c(12, 18, 20, 20), end = c(17, 49, 49, 69), - children = c(1, 0, 0, 0)) + children = c(0, 0, 0, 0)) ret <- rbind(age_bins, groups) ret$adults <- 1 - ret$children From 5be44b112769ab8bec46790ef789714f936da47c Mon Sep 17 00:00:00 2001 From: ruthmccabe Date: Mon, 16 Dec 2024 19:34:24 +0000 Subject: [PATCH 02/19] children defined as those aged under 12 (as per vaccination authorisation) --- R/parameters.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/parameters.R b/R/parameters.R index f7ee574..d470c04 100644 --- a/R/parameters.R +++ b/R/parameters.R @@ -255,7 +255,7 @@ get_compartment_indices <- function() { get_group_bins <- function() { age_bins <- get_age_bins() - age_bins$children <- proportion_in_age_bins(0, 17) + age_bins$children <- proportion_in_age_bins(0, 11) groups <- data.frame(label = c("CSW", "ASW", "PBS", "HCW"), start = c(12, 18, 20, 20), From 51c2a1e579c3e488dcbced8a9ab4498d40f28145 Mon Sep 17 00:00:00 2001 From: ruthmccabe Date: Tue, 17 Dec 2024 11:57:48 +0000 Subject: [PATCH 03/19] update version number --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index d9fa93b..8fa1690 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: mpoxseir Title: Stochastic compartmental model of mpox transmission -Version: 0.2.3 +Version: 0.2.4 Authors@R: c(person("Lilith", "Whittles", role = c("aut", "cre"), email = "l.whittles@imperial.ac.uk"), person("Ruth", "McCabe", role = c("aut")), From 16f028f7f02c23cea7eff46e32034083f001b47b Mon Sep 17 00:00:00 2001 From: ruthmccabe Date: Tue, 17 Dec 2024 11:58:55 +0000 Subject: [PATCH 04/19] updated model doc --- NEWS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS.md b/NEWS.md index 53c6b82..a545d7a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,8 @@ +# mpoxseir 0.2.4 + +* Those aged 12 and above are considered adults (relevant to 12 - 17 & CSWs) + # mpoxseir 0.2.3 * Export cases by transmission route From d098fd8f5d48d30dee996dbd02df48c1f9ba7835 Mon Sep 17 00:00:00 2001 From: ruthmccabe Date: Tue, 17 Dec 2024 14:05:56 +0000 Subject: [PATCH 05/19] reupdate version & docs post rebase --- DESCRIPTION | 2 +- NEWS.md | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8fa1690..f52022d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: mpoxseir Title: Stochastic compartmental model of mpox transmission -Version: 0.2.4 +Version: 0.2.5 Authors@R: c(person("Lilith", "Whittles", role = c("aut", "cre"), email = "l.whittles@imperial.ac.uk"), person("Ruth", "McCabe", role = c("aut")), diff --git a/NEWS.md b/NEWS.md index a545d7a..4a083b2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,12 @@ -# mpoxseir 0.2.4 +# mpoxseir 0.2.5 * Those aged 12 and above are considered adults (relevant to 12 - 17 & CSWs) +# mpoxseir 0.2.4 + +* Increase population of SWs in Sud Kivu + # mpoxseir 0.2.3 * Export cases by transmission route From 9841359f078b4be11e791d33e0aa8285a9214426 Mon Sep 17 00:00:00 2001 From: ruthmccabe Date: Tue, 17 Dec 2024 14:10:00 +0000 Subject: [PATCH 06/19] added test for Sud Kivu for code coverage --- tests/testthat/test-parameters.R | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test-parameters.R b/tests/testthat/test-parameters.R index 086b7ef..224c13d 100644 --- a/tests/testthat/test-parameters.R +++ b/tests/testthat/test-parameters.R @@ -4,7 +4,7 @@ test_that("assign seeds works", { expect_equal(assign_seeds(6, c(3, 2, 1)), c(3, 2, 1)) }) -test_that("Mixing matrices are correct", { +test_that("Mixing matrices are correct in Equateur", { pars <- parameters_demographic(region = "equateur") expect_equal(sum(pars$N0), sum(pars$N_age)) @@ -22,3 +22,22 @@ test_that("Mixing matrices are correct", { sum(upper.tri(M_age, diag = TRUE) * M_age)) expect_equal(m, pars$m_gen_pop) }) + +test_that("Mixing matrices are correct in Sud Kivu", { + pars <- parameters_demographic(region = "sudkivu") + + expect_equal(sum(pars$N0), sum(pars$N_age)) + + M <- pars$total_contacts_nonsexual + M_age <- pars$total_contacts_age + + m <- M / pars$N0 + m[is.na(m)] <- 0 + + expect_true(isSymmetric(M)) + expect_equal(sum(M_age - t(M_age)), 0) + + expect_equal(sum(upper.tri(M, diag = TRUE) * M), + sum(upper.tri(M_age, diag = TRUE) * M_age)) + expect_equal(m, pars$m_gen_pop) +}) From c4e8c1c93ca1ca1399a7128054c0a777d6069b75 Mon Sep 17 00:00:00 2001 From: ruthmccabe Date: Wed, 18 Dec 2024 11:18:05 +0000 Subject: [PATCH 07/19] updated prioritisation strategies in helper function due to age change --- tests/testthat/helper-mpoxseir.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/testthat/helper-mpoxseir.R b/tests/testthat/helper-mpoxseir.R index 06eb07a..bd0abbb 100644 --- a/tests/testthat/helper-mpoxseir.R +++ b/tests/testthat/helper-mpoxseir.R @@ -34,8 +34,8 @@ reference_pars_targeted_vax <- function(region = "equateur") { times=pars$N_prioritisation_steps_children), ncol=pars$N_prioritisation_steps_children, byrow=FALSE) - priority_children[c(3,4,17),1] <- 0 - priority_children[c(4,17),2] <- 0 + priority_children[c(2,3),1] <- 0 + priority_children[3,2] <- 0 pars$prioritisation_strategy_children <- priority_children * 0.5 @@ -43,7 +43,7 @@ reference_pars_targeted_vax <- function(region = "equateur") { times=pars$N_prioritisation_steps_adults), ncol=pars$N_prioritisation_steps_adults, byrow=FALSE) - priority_adults[c(4:16,20),1] <- 0 + priority_adults[c(3:16),1] <- 0 pars$prioritisation_strategy_adults <- priority_adults * 0.5 From 6e0bbaf7d528fcec796ca7a071a0fb8d1cdbec28 Mon Sep 17 00:00:00 2001 From: ruthmccabe Date: Wed, 18 Dec 2024 12:03:08 +0000 Subject: [PATCH 08/19] lowered number of vaccine doses for children as was throwing error otherwise (vaccinating too quickly) --- tests/testthat/test-model-targeted-vax.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test-model-targeted-vax.R b/tests/testthat/test-model-targeted-vax.R index 9342e58..302a248 100644 --- a/tests/testthat/test-model-targeted-vax.R +++ b/tests/testthat/test-model-targeted-vax.R @@ -436,8 +436,8 @@ test_that("1st/2nd dose and adult/child prioritisation steps can be different de pars$prioritisation_strategy_children[,1] <- pars$prioritisation_strategy_children[,1]/4 pars$prioritisation_strategy_adults[,1] <- pars$prioritisation_strategy_adults[,1]/4 - # give lots of vaccines to push through quickly - pars$daily_doses_children_value <- pars$daily_doses_children_value * 100 + # give lots of vaccines to push through quickly + pars$daily_doses_children_value <- pars$daily_doses_children_value * 10 pars$daily_doses_adults_value <- pars$daily_doses_adults_value * 100 sys <- dust2::dust_system_create(model_targeted_vax(), pars, time = 1, From fc4f892460d06629cf4d3c590191d9834e5b523d Mon Sep 17 00:00:00 2001 From: ruthmccabe Date: Fri, 20 Dec 2024 10:30:52 +0000 Subject: [PATCH 09/19] moved boundary check one age group down to reflect new child/adult status --- inst/odin/model-targeted-vax.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inst/odin/model-targeted-vax.R b/inst/odin/model-targeted-vax.R index a946902..a82c930 100644 --- a/inst/odin/model-targeted-vax.R +++ b/inst/odin/model-targeted-vax.R @@ -222,7 +222,7 @@ n_vaccination_t_S[, 2] <- ## for the boundary case do an extra check that we haven't gone over the number ## of people in each compartment -n_vaccination_t_S[4, 2] <- min(n_vaccination_t_S[4, 2], S[4, 2]) +n_vaccination_t_S[3, 2] <- min(n_vaccination_t_S[3, 2], S[3, 2]) ## allocate 2nd doses (adults only for now) n_vaccination_t_S[, 3] <- if (sum(n_eligible_for_dose2_adults[]) == 0) 0 else From b2e50f64cc5f39c39da044d906c25847b532df18 Mon Sep 17 00:00:00 2001 From: ruthmccabe Date: Fri, 20 Dec 2024 10:32:21 +0000 Subject: [PATCH 10/19] updated boundaries check for all comps --- inst/odin/model-targeted-vax.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inst/odin/model-targeted-vax.R b/inst/odin/model-targeted-vax.R index a82c930..b0b5930 100644 --- a/inst/odin/model-targeted-vax.R +++ b/inst/odin/model-targeted-vax.R @@ -262,7 +262,7 @@ n_vaccination_t_Ea[, 2] <- ## for the boundary case do an extra check that we haven't gone over the number ## of people in each compartment -n_vaccination_t_Ea[4, 2] <- min(n_vaccination_t_Ea[4, 2], Ea[4, 2]) +n_vaccination_t_Ea[3, 2] <- min(n_vaccination_t_Ea[3, 2], Ea[3, 2]) ## adults 2nd doses n_vaccination_t_Ea[, 3] <- if (sum(n_eligible_for_dose2_adults[]) == 0) 0 else @@ -302,7 +302,7 @@ n_vaccination_t_Eb[, 2] <- ## for the boundary case do an extra check that we haven't gone over the number ## of people in each compartment -n_vaccination_t_Eb[4, 2] <- min(n_vaccination_t_Eb[4, 2], Eb[4, 2]) +n_vaccination_t_Eb[3, 2] <- min(n_vaccination_t_Eb[3, 2], Eb[3, 2]) ## adults 2nd doses n_vaccination_t_Eb[, 3] <- if (sum(n_eligible_for_dose2_adults[]) == 0) 0 else @@ -342,7 +342,7 @@ n_vaccination_t_R[, 2] <- ## for the boundary case do an extra check that we haven't gone over the number ## of people in each compartment -n_vaccination_t_R[4, 2] <- min(n_vaccination_t_R[4, 2], R[4, 2]) +n_vaccination_t_R[3, 2] <- min(n_vaccination_t_R[3, 2], R[3, 2]) ## adults 2nd doses n_vaccination_t_R[, 3] <- if (sum(n_eligible_for_dose2_adults[]) == 0) 0 else From 677acd5e4a1f295153be4de51c8125f2b531e896 Mon Sep 17 00:00:00 2001 From: ruthmccabe Date: Fri, 20 Dec 2024 11:35:41 +0000 Subject: [PATCH 11/19] failing test expanded with more logic --- tests/testthat/test-model-targeted-vax.R | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/testthat/test-model-targeted-vax.R b/tests/testthat/test-model-targeted-vax.R index 302a248..48117d3 100644 --- a/tests/testthat/test-model-targeted-vax.R +++ b/tests/testthat/test-model-targeted-vax.R @@ -733,8 +733,24 @@ test_that("Test vaccine outputs sum correctly", { group_bins <- get_group_bins() idx_15_plus <- which(group_bins$start >= 15) + # this is failing expect_equal(apply(y$N[idx_15_plus, idx$vax$two_dose, , -1], c(2, 3), sum), res["dose2_cumulative_15_plus", , -max(t)]) + + + expect_equal(apply(y$N[idx_15_plus, idx$vax$one_dose, , -1], c(2, 3), sum), + res["dose1_cumulative_15_plus", , -max(t)]) + + expect_equal(apply(y$N[c(idx$group$`5-9`,idx$group$`10-14`), + idx$vax$one_dose, , -1], c(2, 3), sum), + res["dose1_cumulative_05_14", , -max(t)]) + + expect_equal(apply(y$N[c(idx$group$`5-9`,idx$group$`10-14`), + idx$vax$two_dose, , -1], c(2, 3), sum), + res["dose2_cumulative_05_14", , -max(t)]) + + + # passes from here expect_equal(y$N[idx$group$`0-4`, idx$vax$one_dose, , -1], res["dose1_cumulative_00_04", , -max(t)]) From 2c1620e0f957c8cfe7ec52325f7b61dce3a4673f Mon Sep 17 00:00:00 2001 From: ruthmccabe Date: Fri, 20 Dec 2024 11:36:05 +0000 Subject: [PATCH 12/19] regenerate model --- R/dust.R | 2 +- inst/dust/model-targeted-vax.cpp | 8 ++++---- src/model-targeted-vax.cpp | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/R/dust.R b/R/dust.R index e063d4a..f678c2d 100644 --- a/R/dust.R +++ b/R/dust.R @@ -1,4 +1,4 @@ -## Generated by dust2 (version 0.3.12) - do not edit +## Generated by dust2 (version 0.3.11) - do not edit model_targeted_vax <- structure( function() get("model_targeted_vax"), class = "dust_system_generator", diff --git a/inst/dust/model-targeted-vax.cpp b/inst/dust/model-targeted-vax.cpp index bfd5a97..3f186d4 100644 --- a/inst/dust/model-targeted-vax.cpp +++ b/inst/dust/model-targeted-vax.cpp @@ -1074,7 +1074,7 @@ class model_targeted_vax { for (size_t i = 1; i <= shared.dim.n_vaccination_t_S.dim[0]; ++i) { internal.n_vaccination_t_S[i - 1 + shared.dim.n_vaccination_t_S.mult[1]] = internal.n_vaccination_t_S_children[i - 1] + internal.n_vaccination_t_S_adults[i - 1]; } - internal.n_vaccination_t_S[3 + shared.dim.n_vaccination_t_S.mult[1]] = monty::math::min(internal.n_vaccination_t_S[3 + shared.dim.n_vaccination_t_S.mult[1]], S[3 + shared.dim.S.mult[1]]); + internal.n_vaccination_t_S[2 + shared.dim.n_vaccination_t_S.mult[1]] = monty::math::min(internal.n_vaccination_t_S[2 + shared.dim.n_vaccination_t_S.mult[1]], S[2 + shared.dim.S.mult[1]]); for (size_t i = 1; i <= shared.dim.n_vaccination_t_S.dim[0]; ++i) { internal.n_vaccination_t_S[i - 1 + 2 * shared.dim.n_vaccination_t_S.mult[1]] = (dust2::array::sum(internal.n_eligible_for_dose2_adults.data(), shared.dim.n_eligible_for_dose2_adults) == 0 ? 0 : monty::math::min(monty::math::floor((internal.daily_doses_adults_t[2] * S[i - 1 + 2 * shared.dim.S.mult[1]] * shared.prioritisation_strategy_adults[i - 1 + (prioritisation_step_2nd_dose_adults - 1) * shared.dim.prioritisation_strategy_adults.mult[1]]) / dust2::array::sum(internal.n_eligible_for_dose2_adults.data(), shared.dim.n_eligible_for_dose2_adults)), S[i - 1 + 2 * shared.dim.S.mult[1]])); } @@ -1086,7 +1086,7 @@ class model_targeted_vax { for (size_t i = 1; i <= shared.dim.n_vaccination_t_Ea.dim[0]; ++i) { internal.n_vaccination_t_Ea[i - 1 + shared.dim.n_vaccination_t_Ea.mult[1]] = internal.n_vaccination_t_Ea_children[i - 1] + internal.n_vaccination_t_Ea_adults[i - 1]; } - internal.n_vaccination_t_Ea[3 + shared.dim.n_vaccination_t_Ea.mult[1]] = monty::math::min(internal.n_vaccination_t_Ea[3 + shared.dim.n_vaccination_t_Ea.mult[1]], Ea[3 + shared.dim.Ea.mult[1]]); + internal.n_vaccination_t_Ea[2 + shared.dim.n_vaccination_t_Ea.mult[1]] = monty::math::min(internal.n_vaccination_t_Ea[2 + shared.dim.n_vaccination_t_Ea.mult[1]], Ea[2 + shared.dim.Ea.mult[1]]); for (size_t i = 1; i <= shared.dim.n_vaccination_t_Ea.dim[0]; ++i) { internal.n_vaccination_t_Ea[i - 1 + 2 * shared.dim.n_vaccination_t_Ea.mult[1]] = (dust2::array::sum(internal.n_eligible_for_dose2_adults.data(), shared.dim.n_eligible_for_dose2_adults) == 0 ? 0 : monty::math::min(monty::math::floor((internal.daily_doses_adults_t[2] * Ea[i - 1 + 2 * shared.dim.Ea.mult[1]] * shared.prioritisation_strategy_adults[i - 1 + (prioritisation_step_2nd_dose_adults - 1) * shared.dim.prioritisation_strategy_adults.mult[1]]) / dust2::array::sum(internal.n_eligible_for_dose2_adults.data(), shared.dim.n_eligible_for_dose2_adults)), Ea[i - 1 + 2 * shared.dim.Ea.mult[1]])); } @@ -1098,7 +1098,7 @@ class model_targeted_vax { for (size_t i = 1; i <= shared.dim.n_vaccination_t_Eb.dim[0]; ++i) { internal.n_vaccination_t_Eb[i - 1 + shared.dim.n_vaccination_t_Eb.mult[1]] = internal.n_vaccination_t_Eb_children[i - 1] + internal.n_vaccination_t_Eb_adults[i - 1]; } - internal.n_vaccination_t_Eb[3 + shared.dim.n_vaccination_t_Eb.mult[1]] = monty::math::min(internal.n_vaccination_t_Eb[3 + shared.dim.n_vaccination_t_Eb.mult[1]], Eb[3 + shared.dim.Eb.mult[1]]); + internal.n_vaccination_t_Eb[2 + shared.dim.n_vaccination_t_Eb.mult[1]] = monty::math::min(internal.n_vaccination_t_Eb[2 + shared.dim.n_vaccination_t_Eb.mult[1]], Eb[2 + shared.dim.Eb.mult[1]]); for (size_t i = 1; i <= shared.dim.n_vaccination_t_Eb.dim[0]; ++i) { internal.n_vaccination_t_Eb[i - 1 + 2 * shared.dim.n_vaccination_t_Eb.mult[1]] = (dust2::array::sum(internal.n_eligible_for_dose2_adults.data(), shared.dim.n_eligible_for_dose2_adults) == 0 ? 0 : monty::math::min(monty::math::floor((internal.daily_doses_adults_t[2] * Eb[i - 1 + 2 * shared.dim.Eb.mult[1]] * shared.prioritisation_strategy_adults[i - 1 + (prioritisation_step_2nd_dose_adults - 1) * shared.dim.prioritisation_strategy_adults.mult[1]]) / dust2::array::sum(internal.n_eligible_for_dose2_adults.data(), shared.dim.n_eligible_for_dose2_adults)), Eb[i - 1 + 2 * shared.dim.Eb.mult[1]])); } @@ -1110,7 +1110,7 @@ class model_targeted_vax { for (size_t i = 1; i <= shared.dim.n_vaccination_t_R.dim[0]; ++i) { internal.n_vaccination_t_R[i - 1 + shared.dim.n_vaccination_t_R.mult[1]] = internal.n_vaccination_t_R_children[i - 1] + internal.n_vaccination_t_R_adults[i - 1]; } - internal.n_vaccination_t_R[3 + shared.dim.n_vaccination_t_R.mult[1]] = monty::math::min(internal.n_vaccination_t_R[3 + shared.dim.n_vaccination_t_R.mult[1]], R[3 + shared.dim.R.mult[1]]); + internal.n_vaccination_t_R[2 + shared.dim.n_vaccination_t_R.mult[1]] = monty::math::min(internal.n_vaccination_t_R[2 + shared.dim.n_vaccination_t_R.mult[1]], R[2 + shared.dim.R.mult[1]]); for (size_t i = 1; i <= shared.dim.n_vaccination_t_R.dim[0]; ++i) { internal.n_vaccination_t_R[i - 1 + 2 * shared.dim.n_vaccination_t_R.mult[1]] = (dust2::array::sum(internal.n_eligible_for_dose2_adults.data(), shared.dim.n_eligible_for_dose2_adults) == 0 ? 0 : monty::math::min(monty::math::floor((internal.daily_doses_adults_t[2] * R[i - 1 + 2 * shared.dim.R.mult[1]] * shared.prioritisation_strategy_adults[i - 1 + (prioritisation_step_2nd_dose_adults - 1) * shared.dim.prioritisation_strategy_adults.mult[1]]) / dust2::array::sum(internal.n_eligible_for_dose2_adults.data(), shared.dim.n_eligible_for_dose2_adults)), R[i - 1 + 2 * shared.dim.R.mult[1]])); } diff --git a/src/model-targeted-vax.cpp b/src/model-targeted-vax.cpp index 85706a9..74cab42 100644 --- a/src/model-targeted-vax.cpp +++ b/src/model-targeted-vax.cpp @@ -1,4 +1,4 @@ -// Generated by dust2 (version 0.3.12) - do not edit +// Generated by dust2 (version 0.3.11) - do not edit // Generated by odin2 (version 0.3.14) - do not edit #include @@ -1076,7 +1076,7 @@ class model_targeted_vax { for (size_t i = 1; i <= shared.dim.n_vaccination_t_S.dim[0]; ++i) { internal.n_vaccination_t_S[i - 1 + shared.dim.n_vaccination_t_S.mult[1]] = internal.n_vaccination_t_S_children[i - 1] + internal.n_vaccination_t_S_adults[i - 1]; } - internal.n_vaccination_t_S[3 + shared.dim.n_vaccination_t_S.mult[1]] = monty::math::min(internal.n_vaccination_t_S[3 + shared.dim.n_vaccination_t_S.mult[1]], S[3 + shared.dim.S.mult[1]]); + internal.n_vaccination_t_S[2 + shared.dim.n_vaccination_t_S.mult[1]] = monty::math::min(internal.n_vaccination_t_S[2 + shared.dim.n_vaccination_t_S.mult[1]], S[2 + shared.dim.S.mult[1]]); for (size_t i = 1; i <= shared.dim.n_vaccination_t_S.dim[0]; ++i) { internal.n_vaccination_t_S[i - 1 + 2 * shared.dim.n_vaccination_t_S.mult[1]] = (dust2::array::sum(internal.n_eligible_for_dose2_adults.data(), shared.dim.n_eligible_for_dose2_adults) == 0 ? 0 : monty::math::min(monty::math::floor((internal.daily_doses_adults_t[2] * S[i - 1 + 2 * shared.dim.S.mult[1]] * shared.prioritisation_strategy_adults[i - 1 + (prioritisation_step_2nd_dose_adults - 1) * shared.dim.prioritisation_strategy_adults.mult[1]]) / dust2::array::sum(internal.n_eligible_for_dose2_adults.data(), shared.dim.n_eligible_for_dose2_adults)), S[i - 1 + 2 * shared.dim.S.mult[1]])); } @@ -1088,7 +1088,7 @@ class model_targeted_vax { for (size_t i = 1; i <= shared.dim.n_vaccination_t_Ea.dim[0]; ++i) { internal.n_vaccination_t_Ea[i - 1 + shared.dim.n_vaccination_t_Ea.mult[1]] = internal.n_vaccination_t_Ea_children[i - 1] + internal.n_vaccination_t_Ea_adults[i - 1]; } - internal.n_vaccination_t_Ea[3 + shared.dim.n_vaccination_t_Ea.mult[1]] = monty::math::min(internal.n_vaccination_t_Ea[3 + shared.dim.n_vaccination_t_Ea.mult[1]], Ea[3 + shared.dim.Ea.mult[1]]); + internal.n_vaccination_t_Ea[2 + shared.dim.n_vaccination_t_Ea.mult[1]] = monty::math::min(internal.n_vaccination_t_Ea[2 + shared.dim.n_vaccination_t_Ea.mult[1]], Ea[2 + shared.dim.Ea.mult[1]]); for (size_t i = 1; i <= shared.dim.n_vaccination_t_Ea.dim[0]; ++i) { internal.n_vaccination_t_Ea[i - 1 + 2 * shared.dim.n_vaccination_t_Ea.mult[1]] = (dust2::array::sum(internal.n_eligible_for_dose2_adults.data(), shared.dim.n_eligible_for_dose2_adults) == 0 ? 0 : monty::math::min(monty::math::floor((internal.daily_doses_adults_t[2] * Ea[i - 1 + 2 * shared.dim.Ea.mult[1]] * shared.prioritisation_strategy_adults[i - 1 + (prioritisation_step_2nd_dose_adults - 1) * shared.dim.prioritisation_strategy_adults.mult[1]]) / dust2::array::sum(internal.n_eligible_for_dose2_adults.data(), shared.dim.n_eligible_for_dose2_adults)), Ea[i - 1 + 2 * shared.dim.Ea.mult[1]])); } @@ -1100,7 +1100,7 @@ class model_targeted_vax { for (size_t i = 1; i <= shared.dim.n_vaccination_t_Eb.dim[0]; ++i) { internal.n_vaccination_t_Eb[i - 1 + shared.dim.n_vaccination_t_Eb.mult[1]] = internal.n_vaccination_t_Eb_children[i - 1] + internal.n_vaccination_t_Eb_adults[i - 1]; } - internal.n_vaccination_t_Eb[3 + shared.dim.n_vaccination_t_Eb.mult[1]] = monty::math::min(internal.n_vaccination_t_Eb[3 + shared.dim.n_vaccination_t_Eb.mult[1]], Eb[3 + shared.dim.Eb.mult[1]]); + internal.n_vaccination_t_Eb[2 + shared.dim.n_vaccination_t_Eb.mult[1]] = monty::math::min(internal.n_vaccination_t_Eb[2 + shared.dim.n_vaccination_t_Eb.mult[1]], Eb[2 + shared.dim.Eb.mult[1]]); for (size_t i = 1; i <= shared.dim.n_vaccination_t_Eb.dim[0]; ++i) { internal.n_vaccination_t_Eb[i - 1 + 2 * shared.dim.n_vaccination_t_Eb.mult[1]] = (dust2::array::sum(internal.n_eligible_for_dose2_adults.data(), shared.dim.n_eligible_for_dose2_adults) == 0 ? 0 : monty::math::min(monty::math::floor((internal.daily_doses_adults_t[2] * Eb[i - 1 + 2 * shared.dim.Eb.mult[1]] * shared.prioritisation_strategy_adults[i - 1 + (prioritisation_step_2nd_dose_adults - 1) * shared.dim.prioritisation_strategy_adults.mult[1]]) / dust2::array::sum(internal.n_eligible_for_dose2_adults.data(), shared.dim.n_eligible_for_dose2_adults)), Eb[i - 1 + 2 * shared.dim.Eb.mult[1]])); } @@ -1112,7 +1112,7 @@ class model_targeted_vax { for (size_t i = 1; i <= shared.dim.n_vaccination_t_R.dim[0]; ++i) { internal.n_vaccination_t_R[i - 1 + shared.dim.n_vaccination_t_R.mult[1]] = internal.n_vaccination_t_R_children[i - 1] + internal.n_vaccination_t_R_adults[i - 1]; } - internal.n_vaccination_t_R[3 + shared.dim.n_vaccination_t_R.mult[1]] = monty::math::min(internal.n_vaccination_t_R[3 + shared.dim.n_vaccination_t_R.mult[1]], R[3 + shared.dim.R.mult[1]]); + internal.n_vaccination_t_R[2 + shared.dim.n_vaccination_t_R.mult[1]] = monty::math::min(internal.n_vaccination_t_R[2 + shared.dim.n_vaccination_t_R.mult[1]], R[2 + shared.dim.R.mult[1]]); for (size_t i = 1; i <= shared.dim.n_vaccination_t_R.dim[0]; ++i) { internal.n_vaccination_t_R[i - 1 + 2 * shared.dim.n_vaccination_t_R.mult[1]] = (dust2::array::sum(internal.n_eligible_for_dose2_adults.data(), shared.dim.n_eligible_for_dose2_adults) == 0 ? 0 : monty::math::min(monty::math::floor((internal.daily_doses_adults_t[2] * R[i - 1 + 2 * shared.dim.R.mult[1]] * shared.prioritisation_strategy_adults[i - 1 + (prioritisation_step_2nd_dose_adults - 1) * shared.dim.prioritisation_strategy_adults.mult[1]]) / dust2::array::sum(internal.n_eligible_for_dose2_adults.data(), shared.dim.n_eligible_for_dose2_adults)), R[i - 1 + 2 * shared.dim.R.mult[1]])); } From 85b1afb067df2f772ae3406231b520df43e77070 Mon Sep 17 00:00:00 2001 From: ruthmccabe Date: Fri, 20 Dec 2024 12:11:10 +0000 Subject: [PATCH 13/19] added 15+ indicator to get_group_bins to align with model outputs --- R/parameters.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/parameters.R b/R/parameters.R index 72c0382..32e787c 100644 --- a/R/parameters.R +++ b/R/parameters.R @@ -264,11 +264,13 @@ get_group_bins <- function() { age_bins <- get_age_bins() age_bins$children <- proportion_in_age_bins(0, 11) + age_bins$fifteen_plus <- 1 - proportion_in_age_bins(0,14) groups <- data.frame(label = c("CSW", "ASW", "PBS", "HCW"), start = c(12, 18, 20, 20), end = c(17, 49, 49, 69), - children = c(0, 0, 0, 0)) + children = c(0, 0, 0, 0), + fifteen_plus = c(0.5,1,1,1)) ret <- rbind(age_bins, groups) ret$adults <- 1 - ret$children From 7adfa77fcc009667b49eac929f5a03203a5038cd Mon Sep 17 00:00:00 2001 From: ruthmccabe Date: Fri, 20 Dec 2024 12:14:12 +0000 Subject: [PATCH 14/19] CSWs vaccine split done by round rather than binomial --- inst/odin/model-targeted-vax.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inst/odin/model-targeted-vax.R b/inst/odin/model-targeted-vax.R index b0b5930..912dd26 100644 --- a/inst/odin/model-targeted-vax.R +++ b/inst/odin/model-targeted-vax.R @@ -534,7 +534,7 @@ n_vaccination_t[, ] <- n_vaccination_t_S[i, j] + n_vaccination_t_Ea[i, j] + new_dose1 <- sum(n_vaccination_t[, 2]) new_dose1_00_04 <- n_vaccination_t[1, 2] -new_dose1_SW_12_14 <- Binomial(n_vaccination_t[17, 2], 0.5) +new_dose1_SW_12_14 <- round(n_vaccination_t[17, 2] * 0.5) new_dose1_SW_15_17 <- n_vaccination_t[17, 2] - new_dose1_SW_12_14 new_dose1_05_14 <- sum(n_vaccination_t[2:3, 2]) + new_dose1_SW_12_14 new_dose1_15_plus <- @@ -557,7 +557,7 @@ update(dose1_inc_HCW) <- dose1_inc_HCW + new_dose1_HCW new_dose2 <- sum(n_vaccination_t[, 3]) new_dose2_00_04 <- n_vaccination_t[1, 3] -new_dose2_SW_12_14 <- Binomial(n_vaccination_t[17, 3], 0.5) +new_dose2_SW_12_14 <- round(n_vaccination_t[17, 3] * 0.5) new_dose2_SW_15_17 <- n_vaccination_t[17, 3] - new_dose2_SW_12_14 new_dose2_05_14 <- sum(n_vaccination_t[2:3, 3]) + new_dose2_SW_12_14 new_dose2_15_plus <- From f1db862e188e8a7b562616b72a7d833ce4a06f4c Mon Sep 17 00:00:00 2001 From: ruthmccabe Date: Fri, 20 Dec 2024 12:30:11 +0000 Subject: [PATCH 15/19] test updated to resolve 2nd dose issue --- inst/dust/model-targeted-vax.cpp | 4 ++-- src/model-targeted-vax.cpp | 4 ++-- tests/testthat/test-model-targeted-vax.R | 29 +++++++++++------------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/inst/dust/model-targeted-vax.cpp b/inst/dust/model-targeted-vax.cpp index 3f186d4..741bea1 100644 --- a/inst/dust/model-targeted-vax.cpp +++ b/inst/dust/model-targeted-vax.cpp @@ -1162,14 +1162,14 @@ class model_targeted_vax { } const real_type new_dose1 = dust2::array::sum(internal.n_vaccination_t.data(), shared.dim.n_vaccination_t, {0, shared.dim.n_vaccination_t.dim[0] - 1}, {1, 1}); const real_type new_dose1_00_04 = internal.n_vaccination_t[shared.dim.n_vaccination_t.mult[1]]; - const real_type new_dose1_SW_12_14 = monty::random::binomial(rng_state, internal.n_vaccination_t[16 + shared.dim.n_vaccination_t.mult[1]], static_cast(0.5)); + const real_type new_dose1_SW_12_14 = monty::math::round(internal.n_vaccination_t[16 + shared.dim.n_vaccination_t.mult[1]] * static_cast(0.5)); const real_type new_dose1_CSW = internal.n_vaccination_t[16 + shared.dim.n_vaccination_t.mult[1]]; const real_type new_dose1_ASW = internal.n_vaccination_t[17 + shared.dim.n_vaccination_t.mult[1]]; const real_type new_dose1_PBS = internal.n_vaccination_t[18 + shared.dim.n_vaccination_t.mult[1]]; const real_type new_dose1_HCW = internal.n_vaccination_t[19 + shared.dim.n_vaccination_t.mult[1]]; const real_type new_dose2 = dust2::array::sum(internal.n_vaccination_t.data(), shared.dim.n_vaccination_t, {0, shared.dim.n_vaccination_t.dim[0] - 1}, {2, 2}); const real_type new_dose2_00_04 = internal.n_vaccination_t[2 * shared.dim.n_vaccination_t.mult[1]]; - const real_type new_dose2_SW_12_14 = monty::random::binomial(rng_state, internal.n_vaccination_t[16 + 2 * shared.dim.n_vaccination_t.mult[1]], static_cast(0.5)); + const real_type new_dose2_SW_12_14 = monty::math::round(internal.n_vaccination_t[16 + 2 * shared.dim.n_vaccination_t.mult[1]] * static_cast(0.5)); const real_type new_dose2_CSW = internal.n_vaccination_t[16 + 2 * shared.dim.n_vaccination_t.mult[1]]; const real_type new_dose2_ASW = internal.n_vaccination_t[17 + 2 * shared.dim.n_vaccination_t.mult[1]]; const real_type new_dose2_PBS = internal.n_vaccination_t[18 + 2 * shared.dim.n_vaccination_t.mult[1]]; diff --git a/src/model-targeted-vax.cpp b/src/model-targeted-vax.cpp index 74cab42..8ef3e0e 100644 --- a/src/model-targeted-vax.cpp +++ b/src/model-targeted-vax.cpp @@ -1164,14 +1164,14 @@ class model_targeted_vax { } const real_type new_dose1 = dust2::array::sum(internal.n_vaccination_t.data(), shared.dim.n_vaccination_t, {0, shared.dim.n_vaccination_t.dim[0] - 1}, {1, 1}); const real_type new_dose1_00_04 = internal.n_vaccination_t[shared.dim.n_vaccination_t.mult[1]]; - const real_type new_dose1_SW_12_14 = monty::random::binomial(rng_state, internal.n_vaccination_t[16 + shared.dim.n_vaccination_t.mult[1]], static_cast(0.5)); + const real_type new_dose1_SW_12_14 = monty::math::round(internal.n_vaccination_t[16 + shared.dim.n_vaccination_t.mult[1]] * static_cast(0.5)); const real_type new_dose1_CSW = internal.n_vaccination_t[16 + shared.dim.n_vaccination_t.mult[1]]; const real_type new_dose1_ASW = internal.n_vaccination_t[17 + shared.dim.n_vaccination_t.mult[1]]; const real_type new_dose1_PBS = internal.n_vaccination_t[18 + shared.dim.n_vaccination_t.mult[1]]; const real_type new_dose1_HCW = internal.n_vaccination_t[19 + shared.dim.n_vaccination_t.mult[1]]; const real_type new_dose2 = dust2::array::sum(internal.n_vaccination_t.data(), shared.dim.n_vaccination_t, {0, shared.dim.n_vaccination_t.dim[0] - 1}, {2, 2}); const real_type new_dose2_00_04 = internal.n_vaccination_t[2 * shared.dim.n_vaccination_t.mult[1]]; - const real_type new_dose2_SW_12_14 = monty::random::binomial(rng_state, internal.n_vaccination_t[16 + 2 * shared.dim.n_vaccination_t.mult[1]], static_cast(0.5)); + const real_type new_dose2_SW_12_14 = monty::math::round(internal.n_vaccination_t[16 + 2 * shared.dim.n_vaccination_t.mult[1]] * static_cast(0.5)); const real_type new_dose2_CSW = internal.n_vaccination_t[16 + 2 * shared.dim.n_vaccination_t.mult[1]]; const real_type new_dose2_ASW = internal.n_vaccination_t[17 + 2 * shared.dim.n_vaccination_t.mult[1]]; const real_type new_dose2_PBS = internal.n_vaccination_t[18 + 2 * shared.dim.n_vaccination_t.mult[1]]; diff --git a/tests/testthat/test-model-targeted-vax.R b/tests/testthat/test-model-targeted-vax.R index 48117d3..e71031f 100644 --- a/tests/testthat/test-model-targeted-vax.R +++ b/tests/testthat/test-model-targeted-vax.R @@ -731,24 +731,21 @@ test_that("Test vaccine outputs sum correctly", { idx <- get_compartment_indices() idx_age <- seq_len(nrow(get_age_bins())) group_bins <- get_group_bins() - idx_15_plus <- which(group_bins$start >= 15) + idx_15_plus <- which(group_bins$start >=15) - # this is failing - expect_equal(apply(y$N[idx_15_plus, idx$vax$two_dose, , -1], c(2, 3), sum), + ## age based tests + ## second doses + expect_equal(apply(y$N[idx_15_plus, idx$vax$two_dose, , -1], c(2, 3), sum) + floor(0.5 * (y$N[17, idx$vax$two_dose, , -1])), res["dose2_cumulative_15_plus", , -max(t)]) - - - expect_equal(apply(y$N[idx_15_plus, idx$vax$one_dose, , -1], c(2, 3), sum), - res["dose1_cumulative_15_plus", , -max(t)]) - - expect_equal(apply(y$N[c(idx$group$`5-9`,idx$group$`10-14`), - idx$vax$one_dose, , -1], c(2, 3), sum), - res["dose1_cumulative_05_14", , -max(t)]) - - expect_equal(apply(y$N[c(idx$group$`5-9`,idx$group$`10-14`), - idx$vax$two_dose, , -1], c(2, 3), sum), - res["dose2_cumulative_05_14", , -max(t)]) - + expect_equal(apply(y$N[c(idx$group$`5-9`,idx$group$`10-14`), idx$vax$two_dose, , -1], c(2, 3), sum) + ceiling(0.5 * (y$N[17, idx$vax$two_dose, , -1])), + res["dose2_cumulative_05_14", , -max(t)]) + + # ## 1st doses + # expect_equal(apply(y$N[idx_15_plus, idx$vax$one_dose, , -1], c(2, 3), sum) + floor(0.5 * (y$N[17, idx$vax$one_dose, , -1])), + # res["dose1_cumulative_15_plus", , -max(t)]) + # expect_equal(apply(y$N[c(idx$group$`5-9`,idx$group$`10-14`), idx$vax$one_dose, , -1], c(2, 3), sum) + ceiling(0.5 * (y$N[17, idx$vax$one_dose, , -1])), + # res["dose1_cumulative_05_14", , -max(t)]) + # passes from here expect_equal(y$N[idx$group$`0-4`, idx$vax$one_dose, , -1], From 15919dc5f4e19c965ee35bc2920d6fa48d2e4f0d Mon Sep 17 00:00:00 2001 From: ruthmccabe Date: Fri, 20 Dec 2024 13:44:24 +0000 Subject: [PATCH 16/19] updated 1st dose test & commented out (but not deleted) due to rounding issue --- tests/testthat/test-model-targeted-vax.R | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/testthat/test-model-targeted-vax.R b/tests/testthat/test-model-targeted-vax.R index e71031f..fc26f60 100644 --- a/tests/testthat/test-model-targeted-vax.R +++ b/tests/testthat/test-model-targeted-vax.R @@ -740,14 +740,17 @@ test_that("Test vaccine outputs sum correctly", { expect_equal(apply(y$N[c(idx$group$`5-9`,idx$group$`10-14`), idx$vax$two_dose, , -1], c(2, 3), sum) + ceiling(0.5 * (y$N[17, idx$vax$two_dose, , -1])), res["dose2_cumulative_05_14", , -max(t)]) - # ## 1st doses - # expect_equal(apply(y$N[idx_15_plus, idx$vax$one_dose, , -1], c(2, 3), sum) + floor(0.5 * (y$N[17, idx$vax$one_dose, , -1])), - # res["dose1_cumulative_15_plus", , -max(t)]) - # expect_equal(apply(y$N[c(idx$group$`5-9`,idx$group$`10-14`), idx$vax$one_dose, , -1], c(2, 3), sum) + ceiling(0.5 * (y$N[17, idx$vax$one_dose, , -1])), - # res["dose1_cumulative_05_14", , -max(t)]) - - # passes from here + # # ## 1st doses - slight issues here to do with rounding but very close + # expect_equal(apply(y$N[idx_15_plus, c(idx$vax$one_dose,idx$vax$two_dose), , -1], c(3, 4), sum)+ + # floor(0.5 * apply(y$N[17, c(idx$vax$one_dose,idx$vax$two_dose), , -1], c(2,3), sum)), + # res["dose1_cumulative_15_plus", , -max(t)]) + # + # expect_equal(apply(y$N[c(idx$group$`5-9`,idx$group$`10-14`), c(idx$vax$one_dose,idx$vax$two_dose), , -1], c(3, 4), sum)+ + # floor(0.5 * apply(y$N[17, c(idx$vax$one_dose,idx$vax$two_dose), , -1], c(2,3), sum)), + # res["dose1_cumulative_05_14", , -max(t)]) + + expect_equal(y$N[idx$group$`0-4`, idx$vax$one_dose, , -1], res["dose1_cumulative_00_04", , -max(t)]) From 9607e78c90e0d6b88e8962b8738cd1b049a4860a Mon Sep 17 00:00:00 2001 From: edknock Date: Mon, 6 Jan 2025 12:22:08 +0000 Subject: [PATCH 17/19] bump version number --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index f52022d..df8e5cc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: mpoxseir Title: Stochastic compartmental model of mpox transmission -Version: 0.2.5 +Version: 0.2.6 Authors@R: c(person("Lilith", "Whittles", role = c("aut", "cre"), email = "l.whittles@imperial.ac.uk"), person("Ruth", "McCabe", role = c("aut")), From 1755e59b0ae5930314a020f448e89af39ed254bb Mon Sep 17 00:00:00 2001 From: edknock Date: Mon, 6 Jan 2025 13:03:12 +0000 Subject: [PATCH 18/19] fix tests --- tests/testthat/test-model-targeted-vax.R | 44 +++++++++++++++++------- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/tests/testthat/test-model-targeted-vax.R b/tests/testthat/test-model-targeted-vax.R index 9075acd..9a3d67e 100644 --- a/tests/testthat/test-model-targeted-vax.R +++ b/tests/testthat/test-model-targeted-vax.R @@ -781,27 +781,47 @@ test_that("Test vaccine outputs sum correctly", { group_bins <- get_group_bins() idx_15_plus <- which(group_bins$start >=15) - ## age based tests + ## function that does a diff but appends 0 at the beginning + diff0 <- function(x) c(0, diff(x)) + + ## age/group based tests ## second doses - expect_equal(apply(y$N[idx_15_plus, idx$vax$two_dose, , ], c(2, 3), sum) + floor(0.5 * (y$N[17, idx$vax$two_dose, , ])), + expect_equal(y$N[idx$group$ASW, idx$vax$two_dose, , ], y$dose2_cumulative_ASW) + expect_equal(y$N[idx$group$CSW, idx$vax$two_dose, , ], y$dose2_cumulative_CSW) + expect_equal(y$N[idx$group$HCW, idx$vax$two_dose, , ], y$dose2_cumulative_HCW) + expect_equal(y$N[idx$group$PBS, idx$vax$two_dose, , ], y$dose2_cumulative_PBS) + + ## This is a bit fiddly but we calculate daily incidence from cumulative, + ## split in half (taking the floor) and then calculate cumulative of that + dose2_cumulative_CSW_15_plus <- + t(apply(floor(0.5 * apply(y$dose2_cumulative_CSW, 1, diff0)), 2, cumsum)) + expect_equal(apply(y$N[idx_15_plus, idx$vax$two_dose, , ], c(2, 3), sum) + + dose2_cumulative_CSW_15_plus, res["dose2_cumulative_15_plus", , ]) - expect_equal(apply(y$N[c(idx$group$`5-9`,idx$group$`10-14`), idx$vax$two_dose, , ], c(2, 3), sum) + ceiling(0.5 * (y$N[17, idx$vax$two_dose, , ])), + expect_equal(apply(y$N[c(idx$group$`5-9`, idx$group$`10-14`), idx$vax$two_dose, , ], c(2, 3), sum) + + y$dose2_cumulative_CSW - dose2_cumulative_CSW_15_plus, res["dose2_cumulative_05_14", , ]) - # # ## 1st doses - slight issues here to do with rounding but very close - # expect_equal(apply(y$N[idx_15_plus, c(idx$vax$one_dose,idx$vax$two_dose), , -1], c(3, 4), sum)+ - # floor(0.5 * apply(y$N[17, c(idx$vax$one_dose,idx$vax$two_dose), , -1], c(2,3), sum)), - # res["dose1_cumulative_15_plus", , -max(t)]) - # - # expect_equal(apply(y$N[c(idx$group$`5-9`,idx$group$`10-14`), c(idx$vax$one_dose,idx$vax$two_dose), , -1], c(3, 4), sum)+ - # floor(0.5 * apply(y$N[17, c(idx$vax$one_dose,idx$vax$two_dose), , -1], c(2,3), sum)), - # res["dose1_cumulative_05_14", , -max(t)]) + ## first doses - note we have to account also for people who have had two doses! + expect_equal(apply(y$N[idx$group$ASW, c(idx$vax$one_dose, idx$vax$two_dose), , ], c(2, 3), sum), y$dose1_cumulative_ASW) + expect_equal(apply(y$N[idx$group$CSW, c(idx$vax$one_dose, idx$vax$two_dose), , ], c(2, 3), sum), y$dose1_cumulative_CSW) + expect_equal(apply(y$N[idx$group$HCW, c(idx$vax$one_dose, idx$vax$two_dose), , ], c(2, 3), sum), y$dose1_cumulative_HCW) + expect_equal(apply(y$N[idx$group$PBS, c(idx$vax$one_dose, idx$vax$two_dose), , ], c(2, 3), sum), y$dose1_cumulative_PBS) + + dose1_cumulative_CSW_15_plus <- + t(apply(floor(0.5 * apply(y$dose1_cumulative_CSW, 1, diff0)), 2, cumsum)) + expect_equal(apply(y$N[idx_15_plus, c(idx$vax$one_dose,idx$vax$two_dose), , ], c(3, 4), sum) + + dose1_cumulative_CSW_15_plus, + res["dose1_cumulative_15_plus", , ]) + expect_equal(apply(y$N[c(idx$group$`5-9`, idx$group$`10-14`), c(idx$vax$one_dose, idx$vax$two_dose), , ], c(3, 4), sum) + + y$dose1_cumulative_CSW - dose1_cumulative_CSW_15_plus, + res["dose1_cumulative_05_14", , ]) - expect_equal(y$N[idx$group$`0-4`, idx$vax$one_dose, , ], res["dose1_cumulative_00_04", , ]) + # check age outputs sum to total doses given expect_equal(res["total_vax_1stdose", , ], res["dose1_cumulative_00_04", , ] + From 3a6d9c38fde7a12e5c5204b5353ebf7891caf6c8 Mon Sep 17 00:00:00 2001 From: edknock Date: Mon, 6 Jan 2025 14:14:03 +0000 Subject: [PATCH 19/19] correct news --- NEWS.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 4a083b2..746dfe2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,12 @@ -# mpoxseir 0.2.5 +# mpoxseir 0.2.6 * Those aged 12 and above are considered adults (relevant to 12 - 17 & CSWs) +# mpoxseir 0.2.5 + +* Fixed lag issue affecting some states + # mpoxseir 0.2.4 * Increase population of SWs in Sud Kivu