make_beta
Under Two-Dose Vaccination ModelIcats
are the names of the infected states -- Ia, Ip, Im, Is
Icat_prop_vec
is Ca, Cp, (1 - iso_m) * Cm, (1 - iso_s) * Cs)
beta_0
is beta0 * 1/N * Icat_prop_vec
vax_cat
is a list of state variable suffixes that identify vaccination status unvax, vaxdose1, vaxprotect1, vaxdose2, vaxprotect2
for a two-dose model -- every state variable is categorized in this wayvax_trans_red
is a 5-by-5 matrix (corresponding to the vax_cat
status')vax_cat == vaxprotect1
row to 1 - vax_efficacy_dose1
vax_cat == vaxdose2
row to 1 - vax_efficacy_dose1
vax_cat == vaxprotect2
row to 1 - vax_efficacy_dose2
1
so farbeta_0
gets updated to kron(vax_trans_red, t(beta_0))
beta
is a matrix with 5 rows (same as beta_0
) and n_state
columns -- fill the corresponding beta_0
values in beta
, leaving the remaining columns all zero (so we can leave these out in a more efficient implementation)testcats
are ??add_updated_vaxrate
Under Two-Dose Modelvax_rate
list with one scalar element per doseepi_states
-- "S" "E" "Ia" "Ip" "Im" "Is" "H" "H2" "ICUs" "ICUd" "D" "R" "X" "V"
asymp_cat
-- "S" "E" "Ia" "Ip" "R"
vax_cat
-- "unvax" "vaxdose1" "vaxprotect1" "vaxdose2" "vaxprotect2"
vax_block_dose1
and vax_block_dose2
) with all zeros, with rows and columns each corresponding to one of the epi_states
vax_rate$dose_n
into each of the following elements of vax_block_dose_n
(where _n
is either 1 or 2)asymp_cat
asymp_cat
to "V"
(if "V"
is present)ratemat
:vax_block_dose1
-- unvax
categories to vaxdose_1
categoriesvax_block_dose2
-- vaxprotect1
categories to vaxdose_2
categoriesmake_vaxrate
Under Two-Dose Modelvax_rate
is a vector of rates, each of which will be used to fill many rate matrix elementsasymp_unvax_regex
-- "^(S|E|Ia|Ip|R)_.*unvax"
asymp_vaxprotect1_regex
-- "^(S|E|Ia|Ip|R)_.*vaxprotect1"
dose1
= vax_prop_first_dose
* vax_doses_per_day
/ asymp_unvax_N
dose2
= (1 - vax_prop_second_dose
) * vax_doses_per_day
/ asymp_unvax_N
condense_state
for return_type == "named_vector"
Important: This is not the same as condense.pansim
, which is where the bottleneck could be -- so the tidyverse stuff here is unlikely to be the cause of my problem. On the other hand, this stuff could be a big contributor to the vax slowness and I bet this could be sped up simply with R refactoring (no C++ necessary)
states
-- c("S", "E", "I", "H", "ICU", "R", "D")
states_regex
-- "^S" "^E" "^I" "^H" "^ICU" "^R" "^D"
states_regex
obs_number
column -- which probably means 'time-step' in the case of condensing simulationsobs_number
and var
refer to each valuestate
and subcat
by splitting on _
subcat
a factor (why?)obs_number
and subcat
and summarise, which has the effect of one row per subcat
(e.g. vaxprotect1
), and sum up the valuesobs_number
and a column for each subcat
obs_number
so that the only columns represent subcat
asymp_unvax_N = sum('S_unvax', 'E_unvax', 'Ia_unvax', 'Ip_unvax', 'R_unvax')
asymp_vaxprotect1_N = sum('S_vaxprotect1', 'E_vaxprotect1', 'Ia_vaxprotect1', 'Ip_vaxprotect1', 'R_vaxprotect1')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.