Wrapper function for `run_sim()` that incorporates existing ageify tools

run_sim_ageify(
  base_params,
  base_state,
  age_cat = mk_agecats(),
  beta0 = NULL,
  pmat = mk_pmat(),
  Nvec = mk_Nvec(),
  ...
)

Arguments

base_params

base parameter set without age structure (e.g. generated by `read_params()`)

base_state

base state vector without age structure (e.g. generated by `make_state()`)

age_cat

age categories (e.g. generated by `mk_agecats()`)

beta0

vector of beta0 values for each age group

pmat

contact matrix (e.g. generated by `mk_pmat()`)

Nvec

population distribution (e.g. generated by `mk_Nvec()`)

...

additional arguments to `run_sim()`

Value

simulation results (an object of class `pansim`)

Examples

params <- update(read_params("PHAC_testify.csv"), testing_intensity=0)
state <- make_state(params=params)
run_sim_ageify(base_params = params, base_state = state)
#>          date        S            E            I            H          ICU
#> 1  2020-03-20 999995.0 3.000000e+00 2.000000e+00 0.000000e+00 0.000000e+00
#> 2  2020-03-21 999993.3 3.882387e+00 2.518026e+00 0.000000e+00 0.000000e+00
#> 3  2020-03-22 999991.2 4.994536e+00 3.261453e+00 0.000000e+00 0.000000e+00
#> 4  2020-03-23 999988.4 6.479455e+00 4.242859e+00 1.361194e-03 4.298508e-04
#> 5  2020-03-24 999984.8 8.450503e+00 5.525264e+00 4.756657e-03 1.509463e-03
#> 6  2020-03-25 999979.9 1.104537e+01 7.202360e+00 1.062762e-02 3.389323e-03
#> 7  2020-03-26 999973.7 1.444772e+01 9.397846e+00 1.942987e-02 6.227032e-03
#> 8  2020-03-27 999965.4 1.890208e+01 1.227269e+01 3.176338e-02 1.022823e-02
#> 9  2020-03-28 999954.7 2.473087e+01 1.603670e+01 4.845540e-02 1.567355e-02
#> 10 2020-03-29 999940.6 3.235715e+01 2.096396e+01 7.063605e-02 2.294362e-02
#> 11 2020-03-30 999922.1 4.233485e+01 2.741291e+01 9.982696e-02 3.254870e-02
#> 12 2020-03-31 999898.0 5.538881e+01 3.585243e+01 1.380551e-01 4.516662e-02
#> 13 2020-04-01 999866.4 7.246729e+01 4.689597e+01 1.880022e-01 6.169271e-02
#> 14 2020-04-02 999825.2 9.481069e+01 6.134609e+01 2.532012e-01 8.330530e-02
#> 15 2020-04-03 999771.1 1.240415e+02 8.025269e+01 3.382944e-01 1.115517e-01
#> 16 2020-04-04 999700.5 1.622816e+02 1.049892e+02 4.493711e-01 1.484611e-01
#> 17 2020-04-05 999608.0 2.123061e+02 1.373523e+02 5.944114e-01 1.966919e-01
#> 18 2020-04-06 999487.1 2.777433e+02 1.796917e+02 7.838654e-01 2.597250e-01
#> 19 2020-04-07 999328.9 3.633366e+02 2.350806e+02 1.031412e+00 3.421169e-01
#> 20 2020-04-08 999122.0 4.752852e+02 3.075376e+02 1.354953e+00 4.498300e-01
#> 21 2020-04-09 998851.3 6.216884e+02 4.023169e+02 1.777908e+00 5.906649e-01
#> 22 2020-04-10 998497.3 8.131233e+02 5.262861e+02 2.330913e+00 7.748261e-01
#> 23 2020-04-11 998034.5 1.063395e+03 6.884195e+02 3.054038e+00 1.015660e+00
#> 24 2020-04-12 997429.4 1.390506e+03 9.004399e+02 3.999681e+00 1.330620e+00
#> 25 2020-04-13 996638.5 1.817914e+03 1.177652e+03 5.236348e+00 1.742526e+00
#> 26 2020-04-14 995605.0 2.376139e+03 1.540025e+03 6.853582e+00 2.281205e+00
#> 27 2020-04-15 994255.1 3.104825e+03 2.013589e+03 8.968390e+00 2.985636e+00
#> 28 2020-04-16 992492.9 4.055349e+03 2.632239e+03 1.173360e+01 3.906733e+00
#> 29 2020-04-17 990194.0 5.294097e+03 3.440044e+03 1.534874e+01 5.110969e+00
#> 30 2020-04-18 987197.6 6.906506e+03 4.494191e+03 2.007408e+01 6.685070e+00
#> 31 2020-04-19 983296.6 9.001961e+03 5.868694e+03 2.624891e+01 8.742091e+00
#> 32 2020-04-20 978225.8 1.171953e+04 7.659026e+03 3.431492e+01 1.142924e+01
#> 33 2020-04-21 971647.2 1.523436e+04 9.987794e+03 4.484627e+01 1.493792e+01
#> 34 2020-04-22 963134.6 1.976427e+04 1.301151e+04 5.858782e+01 1.951648e+01
#> 35 2020-04-23 952156.6 2.557546e+04 1.692843e+04 7.650337e+01 2.548638e+01
#> 36 2020-04-24 938060.6 3.298544e+04 2.198701e+04 9.983564e+01 3.326230e+01
#> 37 2020-04-25 920063.0 4.235988e+04 2.849434e+04 1.301798e+02 4.337683e+01
#> 38 2020-04-26 897250.8 5.409827e+04 3.682262e+04 1.695712e+02 5.651007e+01
#> 39 2020-04-27 868605.4 6.860106e+04 4.741122e+04 2.205867e+02 7.352390e+01
#> 40 2020-04-28 833063.5 8.620904e+04 6.075938e+04 2.864547e+02 9.549968e+01
#> 41 2020-04-29 789629.9 1.071056e+05 7.740336e+04 3.711648e+02 1.237763e+02
#> 42 2020-04-30 737557.7 1.311779e+05 9.786932e+04 4.795578e+02 1.599825e+02
#> 43 2020-05-01 676596.9 1.578457e+05 1.225935e+05 6.173632e+02 2.060534e+02
#>               R         hosp            X        death            D
#> 1  0.000000e+00           NA 0.000000e+00           NA 0.000000e+00
#> 2  2.662442e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> 3  5.377628e-01 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
#> 4  8.602539e-01 1.361194e-03 1.361194e-03 0.000000e+00 0.000000e+00
#> 5  1.267242e+00 3.509485e-03 4.870679e-03 1.313229e-05 1.313229e-05
#> 6  1.791507e+00 6.270195e-03 1.114087e-02 4.544739e-05 5.857967e-05
#> 7  2.471796e+00 9.695865e-03 2.083674e-02 1.005997e-04 1.591793e-04
#> 8  3.357407e+00 1.396989e-02 3.480663e-02 1.823209e-04 3.415003e-04
#> 9  4.512407e+00 1.937083e-02 5.417745e-02 2.956739e-04 6.371741e-04
#> 10 6.020469e+00 2.627203e-02 8.044948e-02 4.478137e-04 1.084988e-03
#> 11 7.990989e+00 3.516101e-02 1.156105e-01 6.486568e-04 1.733645e-03
#> 12 1.056703e+01 4.667225e-02 1.622828e-01 9.116578e-04 2.645302e-03
#> 13 1.393568e+01 6.163246e-02 2.239152e-01 1.254812e-03 3.900114e-03
#> 14 1.834169e+01 8.112030e-02 3.050355e-01 1.701974e-03 5.602088e-03
#> 15 2.410519e+01 1.065446e-01 4.115801e-01 2.284605e-03 7.886693e-03
#> 16 3.164494e+01 1.397464e-01 5.513265e-01 3.044059e-03 1.093075e-02
#> 17 4.150877e+01 1.831325e-01 7.344589e-01 4.034592e-03 1.496534e-02
#> 18 5.441332e+01 2.398499e-01 9.743088e-01 5.327308e-03 2.029265e-02
#> 19 7.129603e+01 3.140142e-01 1.288323e+00 7.015315e-03 2.730797e-02
#> 20 9.338317e+01 4.110071e-01 1.699330e+00 9.220484e-03 3.652845e-02
#> 21 1.222787e+02 5.378664e-01 2.237197e+00 1.210229e-02 4.863074e-02
#> 22 1.600803e+02 7.037947e-01 2.940991e+00 1.586937e-02 6.450011e-02
#> 23 2.095314e+02 9.208236e-01 3.861815e+00 2.079461e-02 8.529472e-02
#> 24 2.742193e+02 1.204680e+00 5.066495e+00 2.723494e-02 1.125297e-01
#> 25 3.588334e+02 1.575917e+00 6.642412e+00 3.565705e-02 1.481867e-01
#> 26 4.695032e+02 2.061383e+00 8.703796e+00 4.667109e-02 1.948578e-01
#> 27 6.142370e+02 2.696137e+00 1.139993e+01 6.107454e-02 2.559323e-01
#> 28 8.034943e+02 3.525927e+00 1.492586e+01 7.990941e-02 3.358417e-01
#> 29 1.050928e+03 4.610404e+00 1.953626e+01 1.045366e-01 4.403784e-01
#> 30 1.374345e+03 6.027264e+00 2.556353e+01 1.367327e-01 5.771110e-01
#> 31 1.796953e+03 7.877567e+00 3.344109e+01 1.788149e-01 7.559260e-01
#> 32 2.348956e+03 1.029252e+01 4.373361e+01 2.338034e-01 9.897294e-01
#> 33 3.069601e+03 1.344206e+01 5.717567e+01 3.056291e-01 1.295359e+00
#> 34 4.009779e+03 1.754560e+01 7.472127e+01 3.994007e-01 1.694759e+00
#> 35 5.235297e+03 2.288524e+01 9.760652e+01 5.217432e-01 2.216502e+00
#> 36 6.830942e+03 2.982171e+01 1.274282e+02 6.812250e-01 2.897727e+00
#> 37 8.905435e+03 3.881289e+01 1.662411e+02 8.888876e-01 3.786615e+00
#> 38 1.159732e+04 5.043436e+01 2.166755e+02 1.158893e+00 4.945508e+00
#> 39 1.508174e+04 6.540023e+01 2.820757e+02 1.509291e+00 6.454798e+00
#> 40 1.957768e+04 8.458093e+01 3.666566e+02 1.962901e+00 8.417700e+00
#> 41 2.535522e+04 1.090118e+02 4.756684e+02 2.548259e+00 1.096596e+01
#> 42 3.274126e+04 1.398827e+02 6.155511e+02 3.300536e+00 1.426649e+01
#> 43 4.212194e+04 1.784938e+02 7.940449e+02 4.262248e+00 1.852874e+01
#>         foi_0-9    foi_10-19    foi_20-29    foi_30-39    foi_40-49
#> 1  1.666667e-06 1.666667e-06 1.666667e-06 1.666667e-06 1.666667e-06
#> 2  2.127111e-06 2.127111e-06 2.127111e-06 2.127111e-06 2.127111e-06
#> 3  2.790635e-06 2.790635e-06 2.790635e-06 2.790635e-06 2.790635e-06
#> 4  3.664978e-06 3.664978e-06 3.664978e-06 3.664978e-06 3.664978e-06
#> 5  4.804107e-06 4.804107e-06 4.804107e-06 4.804107e-06 4.804107e-06
#> 6  6.290014e-06 6.290014e-06 6.290014e-06 6.290014e-06 6.290014e-06
#> 7  8.231577e-06 8.231577e-06 8.231577e-06 8.231577e-06 8.231577e-06
#> 8  1.077067e-05 1.077067e-05 1.077067e-05 1.077067e-05 1.077067e-05
#> 9  1.409224e-05 1.409224e-05 1.409224e-05 1.409224e-05 1.409224e-05
#> 10 1.843788e-05 1.843788e-05 1.843788e-05 1.843788e-05 1.843788e-05
#> 11 2.412345e-05 2.412345e-05 2.412345e-05 2.412345e-05 2.412345e-05
#> 12 3.156212e-05 3.156212e-05 3.156212e-05 3.156212e-05 3.156212e-05
#> 13 4.129440e-05 4.129440e-05 4.129440e-05 4.129440e-05 4.129440e-05
#> 14 5.402741e-05 5.402741e-05 5.402741e-05 5.402741e-05 5.402741e-05
#> 15 7.068614e-05 7.068614e-05 7.068614e-05 7.068614e-05 7.068614e-05
#> 16 9.248066e-05 9.248066e-05 9.248066e-05 9.248066e-05 9.248066e-05
#> 17 1.209937e-04 1.209937e-04 1.209937e-04 1.209937e-04 1.209937e-04
#> 18 1.582956e-04 1.582956e-04 1.582956e-04 1.582956e-04 1.582956e-04
#> 19 2.070937e-04 2.070937e-04 2.070937e-04 2.070937e-04 2.070937e-04
#> 20 2.709284e-04 2.709284e-04 2.709284e-04 2.709284e-04 2.709284e-04
#> 21 3.544286e-04 3.544286e-04 3.544286e-04 3.544286e-04 3.544286e-04
#> 22 4.636446e-04 4.636446e-04 4.636446e-04 4.636446e-04 4.636446e-04
#> 23 6.064830e-04 6.064830e-04 6.064830e-04 6.064830e-04 6.064830e-04
#> 24 7.932715e-04 7.932715e-04 7.932715e-04 7.932715e-04 7.932715e-04
#> 25 1.037494e-03 1.037494e-03 1.037494e-03 1.037494e-03 1.037494e-03
#> 26 1.356743e-03 1.356743e-03 1.356743e-03 1.356743e-03 1.356743e-03
#> 27 1.773952e-03 1.773952e-03 1.773952e-03 1.773952e-03 1.773952e-03
#> 28 2.318986e-03 2.318986e-03 2.318986e-03 2.318986e-03 2.318986e-03
#> 29 3.030671e-03 3.030671e-03 3.030671e-03 3.030671e-03 3.030671e-03
#> 30 3.959394e-03 3.959394e-03 3.959394e-03 3.959394e-03 3.959394e-03
#> 31 5.170372e-03 5.170372e-03 5.170372e-03 5.170372e-03 5.170372e-03
#> 32 6.747735e-03 6.747735e-03 6.747735e-03 6.747735e-03 6.747735e-03
#> 33 8.799527e-03 8.799527e-03 8.799527e-03 8.799527e-03 8.799527e-03
#> 34 1.146369e-02 1.146369e-02 1.146369e-02 1.146369e-02 1.146369e-02
#> 35 1.491496e-02 1.491496e-02 1.491496e-02 1.491496e-02 1.491496e-02
#> 36 1.937241e-02 1.937241e-02 1.937241e-02 1.937241e-02 1.937241e-02
#> 37 2.510678e-02 2.510678e-02 2.510678e-02 2.510678e-02 2.510678e-02
#> 38 3.244642e-02 3.244642e-02 3.244642e-02 3.244642e-02 3.244642e-02
#> 39 4.177905e-02 4.177905e-02 4.177905e-02 4.177905e-02 4.177905e-02
#> 40 5.354557e-02 5.354557e-02 5.354557e-02 5.354557e-02 5.354557e-02
#> 41 6.822005e-02 6.822005e-02 6.822005e-02 6.822005e-02 6.822005e-02
#> 42 8.626853e-02 8.626853e-02 8.626853e-02 8.626853e-02 8.626853e-02
#> 43 1.080789e-01 1.080789e-01 1.080789e-01 1.080789e-01 1.080789e-01
#>       foi_50-59    foi_60-69    foi_70-79    foi_80-89      foi_90+
#> 1  1.666667e-06 1.666667e-06 1.666667e-06 1.666667e-06 1.666667e-06
#> 2  2.127111e-06 2.127111e-06 2.127111e-06 2.127111e-06 2.127111e-06
#> 3  2.790635e-06 2.790635e-06 2.790635e-06 2.790635e-06 2.790635e-06
#> 4  3.664978e-06 3.664978e-06 3.664978e-06 3.664978e-06 3.664978e-06
#> 5  4.804107e-06 4.804107e-06 4.804107e-06 4.804107e-06 4.804107e-06
#> 6  6.290014e-06 6.290014e-06 6.290014e-06 6.290014e-06 6.290014e-06
#> 7  8.231577e-06 8.231577e-06 8.231577e-06 8.231577e-06 8.231577e-06
#> 8  1.077067e-05 1.077067e-05 1.077067e-05 1.077067e-05 1.077067e-05
#> 9  1.409224e-05 1.409224e-05 1.409224e-05 1.409224e-05 1.409224e-05
#> 10 1.843788e-05 1.843788e-05 1.843788e-05 1.843788e-05 1.843788e-05
#> 11 2.412345e-05 2.412345e-05 2.412345e-05 2.412345e-05 2.412345e-05
#> 12 3.156212e-05 3.156212e-05 3.156212e-05 3.156212e-05 3.156212e-05
#> 13 4.129440e-05 4.129440e-05 4.129440e-05 4.129440e-05 4.129440e-05
#> 14 5.402741e-05 5.402741e-05 5.402741e-05 5.402741e-05 5.402741e-05
#> 15 7.068614e-05 7.068614e-05 7.068614e-05 7.068614e-05 7.068614e-05
#> 16 9.248066e-05 9.248066e-05 9.248066e-05 9.248066e-05 9.248066e-05
#> 17 1.209937e-04 1.209937e-04 1.209937e-04 1.209937e-04 1.209937e-04
#> 18 1.582956e-04 1.582956e-04 1.582956e-04 1.582956e-04 1.582956e-04
#> 19 2.070937e-04 2.070937e-04 2.070937e-04 2.070937e-04 2.070937e-04
#> 20 2.709284e-04 2.709284e-04 2.709284e-04 2.709284e-04 2.709284e-04
#> 21 3.544286e-04 3.544286e-04 3.544286e-04 3.544286e-04 3.544286e-04
#> 22 4.636446e-04 4.636446e-04 4.636446e-04 4.636446e-04 4.636446e-04
#> 23 6.064830e-04 6.064830e-04 6.064830e-04 6.064830e-04 6.064830e-04
#> 24 7.932715e-04 7.932715e-04 7.932715e-04 7.932715e-04 7.932715e-04
#> 25 1.037494e-03 1.037494e-03 1.037494e-03 1.037494e-03 1.037494e-03
#> 26 1.356743e-03 1.356743e-03 1.356743e-03 1.356743e-03 1.356743e-03
#> 27 1.773952e-03 1.773952e-03 1.773952e-03 1.773952e-03 1.773952e-03
#> 28 2.318986e-03 2.318986e-03 2.318986e-03 2.318986e-03 2.318986e-03
#> 29 3.030671e-03 3.030671e-03 3.030671e-03 3.030671e-03 3.030671e-03
#> 30 3.959394e-03 3.959394e-03 3.959394e-03 3.959394e-03 3.959394e-03
#> 31 5.170372e-03 5.170372e-03 5.170372e-03 5.170372e-03 5.170372e-03
#> 32 6.747735e-03 6.747735e-03 6.747735e-03 6.747735e-03 6.747735e-03
#> 33 8.799527e-03 8.799527e-03 8.799527e-03 8.799527e-03 8.799527e-03
#> 34 1.146369e-02 1.146369e-02 1.146369e-02 1.146369e-02 1.146369e-02
#> 35 1.491496e-02 1.491496e-02 1.491496e-02 1.491496e-02 1.491496e-02
#> 36 1.937241e-02 1.937241e-02 1.937241e-02 1.937241e-02 1.937241e-02
#> 37 2.510678e-02 2.510678e-02 2.510678e-02 2.510678e-02 2.510678e-02
#> 38 3.244642e-02 3.244642e-02 3.244642e-02 3.244642e-02 3.244642e-02
#> 39 4.177905e-02 4.177905e-02 4.177905e-02 4.177905e-02 4.177905e-02
#> 40 5.354557e-02 5.354557e-02 5.354557e-02 5.354557e-02 5.354557e-02
#> 41 6.822005e-02 6.822005e-02 6.822005e-02 6.822005e-02 6.822005e-02
#> 42 8.626853e-02 8.626853e-02 8.626853e-02 8.626853e-02 8.626853e-02
#> 43 1.080789e-01 1.080789e-01 1.080789e-01 1.080789e-01 1.080789e-01
#>       incidence      report      cumRep
#> 1      1.666658          NA    0.000000
#> 2      2.127097          NA    0.000000
#> 3      2.790611          NA    0.000000
#> 4      3.664936          NA    0.000000
#> 5      4.804033          NA    0.000000
#> 6      6.289888          NA    0.000000
#> 7      8.231360          NA    0.000000
#> 8     10.770297          NA    0.000000
#> 9     14.091604          NA    0.000000
#> 10    18.436783          NA    0.000000
#> 11    24.121568          NA    0.000000
#> 12    31.558899          NA    0.000000
#> 13    41.288889          NA    0.000000
#> 14    54.017961          NA    0.000000
#> 15    70.669968          NA    0.000000
#> 16    92.452957    0.941770    0.941770
#> 17   120.946307    1.232320    2.174090
#> 18   158.214392    1.612486    3.786577
#> 19   206.954685    2.109779    5.896356
#> 20   270.690501    2.760310    8.656666
#> 21   354.021420    3.611325   12.267991
#> 22   462.947919    4.724599   16.992590
#> 23   605.290972    6.180907   23.173496
#> 24   791.232296    8.085846   31.259342
#> 25  1034.006276   10.577442   41.836784
#> 26  1350.779941   13.836056   55.672840
#> 27  1763.761335   18.097274   73.770113
#> 28  2301.577073   23.668664   97.438777
#> 29  3000.952405   30.951499  128.390276
#> 30  3908.704535   40.468846  168.859123
#> 31  5084.009818   52.901746  221.760869
#> 32  6600.808346   69.135587  290.896456
#> 33  8550.035415   90.319137  381.215593
#> 34 11041.076821  117.939005  499.154598
#> 35 14201.382181  153.912405  653.067003
#> 36 18172.490174  200.700692  853.767695
#> 37 23099.818096  261.444908 1115.212603
#> 38 29112.575927  340.121634 1455.334237
#> 39 36289.512634  441.711922 1897.046159
#> 40 44606.865092  572.366106 2469.412265
#> 41 53868.590680  739.531147 3208.943412
#> 42 63628.015315  951.982336 4160.925749
#> 43 73125.864471 1219.666629 5380.592378