This document is intended to give a more detailed description (beyond what’s described in the “Getting Started” vignette) of model calibration with MacPan.
The fix_pars
function takes an initial/baseline set of parameters and user-specified values of summary “moments” of the parameters (one or more of the intrinsic growth rate \(r\), the intrinsic reproductive number \(R_0\), and the generation interval \(\bar G\)). For each summary metric, the user also gives a set of parameters that are to be adjusted (all by the same multiplier) to achieve the target. The function returns an adjusted set of parameters that correspond to the requested metrics.
This step is useful to get the initial values into a reasonable ballpark, or to adjust parameters that will not be tuned in the full calibration step.
In general, time-varying parameters are specified by a data frame (params_timevar
argument) of the following form:
Date Symbol Relative_value
1 2020-03-23 beta0 0.9
2 2020-03-30 beta0 NA
3 2020-04-01 beta0 1.2
where Date
is the date of a breakpoint Symbol
refers to the name of a value in the parameter vector. If numeric, Relative_value
is the relative value (i.e., relative to the value in the baseline params
vector) to switch to at the specified date. If NA
, the relative value will be a calibrated parameter.
The opt_pars
list specifies which parameters to calibrate, and their starting value:
params
element specifies starting calibratation values corresponding to elements of the (unlisted?) params
vectortime_params
(or [link_]time_params
) element specifies starting values for the calibrated values in params_timevar
(it should be the same length and for now should match the missing elements by position)[link_]nb_disp
element specifies calibrated dispersion parametersPrepending log_
or logit_
to a parameter name in opt_pars
will automatically specify that it is to be fitted on the corresponding “link” scale (this is the scale on which starting values are specified).
Describe model calibration here: by (1) MLE fitting or (2) log-linear regression to exponential-phase data.
calibrate()
function takes a given set of baseline parameters and adjusts a specified subset of them (at the moment this is fixed to be (1) the baseline transmission rate and (2) the latent period and infection periods for all but the presymptomatic period) to achieve the observed value of \(r\) and one or more other epidemiological characteristics (at present \(\bar G\), the mean generation interval)The top-level function is calibrate()
: the machinery is in R/calibrate.R
Possible calibration issues:
Brain dump from e-mail:
Our calibration is/will be based on
Note that we could fake a testing lag (for now) by simple post-hoc adjustment of case times vs. other times. Don’t yet have a good solution for dependence of case numbers on testing intensity though (see testing_flow.md
).