-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement time varying coverage for PEV boosters: #270
Conversation
R/pev_parameters.R
Outdated
@@ -88,6 +90,8 @@ set_pev_epi <- function( | |||
min_wait, | |||
booster_timestep, | |||
booster_coverage, | |||
booster_timed_coverage = NULL, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this can be simplified given that boosters will always be associated with the primary serires.
Would the following reduced arguments work:
timesteps
define the vaccine coverage change timepoints at which primary series coverage or booster coverage changes.
booster_coverage
(like, coverages
) is a vector of length timesteps of booster coverages
Boosters are given at booster_timestep
post primary series. For clarity this could be renamed (booster_lags
or booster_spacing
?)
That would remove the requirement for the two addtional arguments here: booster_timed_coverage
booster_timed_coverage_timestep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@giovannic @lmhaile
Any thoughts on if the above would be sensible/helpful?
Happy to re-review otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Pete, thanks for boosting! Yes I agree that booster_timed_coverage_timestep
could be removed in favor of timesteps
, as boosters will always be associated with the primary series.
Also agree that booster_timestep
could be renamed to booster_spacing
to avoid confusion.
We may need to keep booster_coverage
and booster_timed_coverage
as is to avoid breaking the code of people implementing flat booster coverage across time.
Otherwise the changes look great-- everything is working as expected now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! Sorry for the delay!
I think I get it and it makes a lot of sense. I can get on it later this week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to confirm, booster_coverage
would need to be a matrix? Because we have (potentially) several boosters and several timesteps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay while I was OOO Giovanni! Yes, booster_coverage
would need to be a matrix to account for more than one booster.
Hope you had a nice new year and just let me know if you have other thoughts!
Hi Giovanni! I'm having some trouble getting the booster functionality to work as intended-- reproducible example below. Based on the parameter changes I would expect boosters to disappear from the model output by the fourth year, but they seem to be consistent throughout the time series-- perhaps there is something I am missing?
Looking at the PR, it seems like the issue may have to do with this function, although I am not entirely sure: Lines 179 to 217 in a87b4f1
|
Ah! That was my mistake, sorry. This should be fixed with the latest commit. |
ddfb268
to
685dea1
Compare
* Update documentation * Update parameterisation and tests * Update booster listener to incorporate timed coverage * Update attach_events to pass timed coverage parameters * Test timed coverage sampling * Bonus: fix a biology test
d13e23e
to
bdef3f5
Compare
* rename booster_timesteps -> booster_spacing * make booster_coverage a matrix (timestep x booster doses) * update validation * update implementation of attach_booster_listener * fix regression tests * update documentation * update vignettes * fix correlation examples
bdef3f5
to
91247b4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reran my same quick test with the parameter name changes and all looks well- much more intuitive to me now!
remotes::install_github('mrc-ide/malariasimulation@feat/time_boosters')
library(malariasimulation)
plot_doses <- function(){
cols <- c("#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7")
output$month <- ceiling(output$timestep / month)
doses <- output[, c(grep("n_pev" , names(output)), grep("month", names(output)))]
doses <- aggregate(cbind(doses[1:4]),
by = list(doses$month),
FUN = sum)
doses <- as.matrix(t(doses[, -1]))
barplot(doses, xlab = "Month",
ylab = "Number of doses",
col = cols[1:6], space = 0, axes = T,
beside = FALSE, xaxs = "i", yaxs = "i",
ylim = c(0, 230))
grid(lty = 2, col = "grey80", lwd = 0.5);box()
axis(side = 1, lty = 1, col = "black", pos = 0)
legend("topleft", box.lty = 0, legend = c("Dose 1","Dose 2","Dose 3","Booster 1"),
fill = cols[1:6], bg="transparent", cex = 0.8, y.intersp = 1.5)
}
year <- 365
month <- 30
sim_length <- 3 * year
human_population <- 10000
starting_EIR <- 20
simparams <- get_parameters(list(
human_population = human_population,
clinical_incidence_rendering_min_ages = 0,
clinical_incidence_rendering_max_ages = 5 * year,
individual_mosquitoes = FALSE
)
)
simparams <- set_equilibrium(parameters = simparams, init_EIR = starting_EIR)
# add changing coverage
rtssepiparams2 <- set_pev_epi(
simparams,
profile = rtss_profile,
timesteps = c(1, 2, 3, 4) * year,
coverages = c(1, 1, 1, 1),
age = 5 * month,
min_wait = 0,
booster_spacing= c(12 * month), # booster is always implemented 1 year after third dose
booster_coverage = matrix(c(1, 1, 0.0, 0.0), ncol = 1),
booster_profile = list(rtss_booster_profile)
)
output <- run_simulation(timesteps = sim_length * 2, parameters = rtssepiparams2)
plot_doses()
We may need to forecast this change to some of the other vaccine modellers (Kelly, Nora) as the booster_spacing and booster_coverage changes may break their code (a Teams post?). Thanks for the update, Giovanni!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great - just one minor comment
@@ -86,12 +85,13 @@ set_pev_epi <- function( | |||
timesteps, | |||
age, | |||
min_wait, | |||
booster_timestep, | |||
booster_spacing, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have a check that the vector of booster spacings are monotonically increasing when more than one booster is used - setting otherwise gives quite a cryptic Error: delay must be >= 0
error
Some functionality to allow booster coverage to change over time. This "booster timed coverage" is multiplied with the previous "booster coverage" which is used to model dropouts.
Changes:
Fixes #269