calibrate_comb | R Documentation |
Top-level calibration based on mobility, splines, and
phenomenological heterogeneity. This function is a wrapper for
calibrate
, which first sets up the model matrix for
time-dependent transmission rates \beta(t)
. For example,
for splines, it sets up the spline basis and the coefficients of
each basis function. For mobility, it sets up the slope and
intercept parameters (since mobility is treated as a log-linear
function between break points).
calibrate_comb(
data,
params,
opt_pars = NULL,
mob_data = NULL,
mob_breaks = NULL,
mob_breaks_int = FALSE,
mob_logist_scale = NA,
spline_days = 14,
spline_setback = 0,
spline_extrap = c("linear", "constant"),
spline_df = NA,
knot_quantile_var = NA,
spline_pen = 0,
spline_type = "bs",
spline_int = FALSE,
testing_data = NULL,
maxit = 10000,
skip.hessian = FALSE,
use_DEoptim = TRUE,
DE_cores = 1,
beta_break_dates = NULL,
use_mobility = FALSE,
use_phenomhet = FALSE,
use_spline = FALSE,
use_testing = FALSE,
vars = NULL,
debug_plot = interactive(),
debug = FALSE,
debug_hist = FALSE,
return_val = c("fit", "X", "formula", "args", "time_args"),
start_date = NULL,
priors = list(),
...
)
data |
a data set to compare to, containing date/var/value (current version assumes that only a single state var is included) |
params |
parameters |
opt_pars |
starting parameters (and structure). Parameters
that are part of the |
mob_data |
mobility data |
mob_breaks |
vector of breakpoints for piecewise mobility model |
mob_breaks_int |
(logical) specifies whether the intercept of
the mobility/transmission relationship changes at each
mobility breakpoint. The default ( |
mob_logist_scale |
specifies the scale of the smooth
(logistic) transition between mobility periods, in days: if it
is |
spline_days |
days between spline knots |
spline_setback |
days before end of time series to set
boundary knots for spline (this implies linear
extrapolation after knots if |
spline_extrap |
spline extrapolation model ("linear" or "constant") |
spline_df |
overall spline degrees of freedom |
knot_quantile_var |
variable to use cum dist for knotspacing |
spline_pen |
penalization for spline |
spline_type |
spline type ("ns" for natural spline or "bs" for b-spline) |
spline_int |
spline intercept (??) |
testing_data |
data frame with columns containing dates
( |
maxit |
maximum iterations for Nelder-Mead/optimization step |
skip.hessian |
skip Hessian calculation? |
use_DEoptim |
use differential evolution as first stage? |
DE_cores |
number of parallel workers for DE |
beta_break_dates |
discrete break dates for transmission changes |
use_mobility |
include mobility as a covariate in the model? |
use_phenomhet |
include phenomenological heterogeneity? |
use_spline |
include spline? |
use_testing |
include variation in testing intensity? |
vars |
which vars to use? (default is all in data) |
debug_plot |
plot debugging curves? (doesn't work with parallel DEoptim) |
debug |
print debugging messages? |
debug_hist |
keep information on parameter history? |
return_val |
"fit" (return calibrated value); "X" (short-circuit/return model matrix?); "formula" (return log-linear formula for time-varying beta) |
start_date |
start date |
priors |
a list of tilde-delimited expressions giving prior
distributions expressed in terms of the elements of
|
... |
extra args |
Other classic_macpan:
add_d_log()
,
add_updated_vaxrate()
,
aggregate_agecats()
,
calibrate()
,
check_age_cat_compatibility()
,
check_contact_rate_setting()
,
col_multiply()
,
condense_age()
,
condense_params_vax()
,
condense_state()
,
condense_vax()
,
dev_is_tikz()
,
do_step()
,
expand_params_age()
,
expand_params_desc_age()
,
expand_params_desc_variant()
,
expand_params_desc_vax()
,
expand_params_mistry()
,
expand_params_variant()
,
expand_params_vax()
,
expand_state_age()
,
expand_state_vax()
,
expand_stateval_testing()
,
fix_pars()
,
fix_stored()
,
forecast_ensemble()
,
forecast_sim()
,
getData()
,
get_GI_moments()
,
get_Gbar()
,
get_R0()
,
get_doses_per_day()
,
get_evec()
,
get_kernel_moments()
,
get_opt_pars()
,
get_r()
,
invlink_trans()
,
make_betavec()
,
make_beta()
,
make_jac()
,
make_ratemat()
,
make_state()
,
make_test_wtsvec()
,
make_vaxrate()
,
mk_Nvec()
,
mk_agecats()
,
mk_contact_rate_setting()
,
mk_mistry_Nvec()
,
mk_pmat()
,
mk_vaxcats()
,
mle_fun()
,
non_expanded_states
,
rExp()
,
read_params()
,
repair_names_age()
,
restore()
,
run_sim_ageify()
,
run_sim_break()
,
run_sim_loglin()
,
run_sim_mobility()
,
run_sim_range()
,
run_sim()
,
show_ratemat()
,
testify()
,
texify()
,
trans_state_vars()
,
update_contact_rate_setting()
,
update_foi()
,
update_params_mistry()
,
vis_model()
,
write_params()
if (require(dplyr)) {
dd <- ont_all %>% trans_state_vars() %>%
filter(var %in% c("H","report"))
params <- read_params("ICU1.csv")
## quick and dirty example (maximize speed)
## Not run:
calibrate_comb(data=dd, params=params,
use_spline=TRUE,
maxit=10, skip.hessian=TRUE, use_DEoptim =FALSE)
X <- calibrate_comb(data=dd, params=params,
use_spline=TRUE,
spline_type="ns",
spline_setback=1,
spline_extrap="constant",
return_val="X")
matplot(X, ylab="")
form <- calibrate_comb(data=dd, params=params,
use_spline=TRUE,
spline_type="ns",
spline_setback=1,
spline_extrap="constant",
return_val="formula")
print(form)
## End(Not run)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.