Open giovannic opened 4 years ago
Do interpolations beforehand. Then in the process do a lookup
Rough outline/thoughts for this. Users will want to provide values of R0 in one of two ways:
If we pass to squire::parameters_explicit_SEEIR
a vector of the timesteps ( seq(0, end_timestep, 1)
) and a vector of R0 values then we will get back in pars
a vector of beta
values for each timestep. These need to then be correctly used for each timestep in this line:
https://github.com/mrc-ide/hypatia/blob/main/R/infection_process.R#L30
lambda <- pars$beta * rowSums(m %*% diag(inf_ages))
We need to change that so that instead of using pars$beta
we use pars$beta[current_timestep]
. We should be able to get current_timestep
from the individual
api (api$get_timestep()
).
The simplest way I can see then is to make it so that if the user provides one value of R0, we adapt pars$beta
so that it has the same length as the number of timesteps. And then add in some checks to make sure that if the user provides fewer than the number of timesteps worth of betas we throw an error to tell them to provide and R0 value for every timestep.
(Later on we can add some interpolation functions to hypatia
to catch examples where the user provides say tt_R0 = c(0,10,20,30) and R0 = c(4,3,2,1) and we do some linear interpolation to make it so that they have passed as.numeric(mapply(rep, 4:1, diff(c(0,10,20,30,end_timestep))))
for the R0 etc. But for the time being let's assume they either provide 1 value or a vector)
We should allow a time series of Rt to be specified through tt_R0 and R0 parameters.
This involves integrating interpolation between the time points for R0.
Tests: