InstituteforDiseaseModeling / covasim

COVID-19 Agent-based Simulator (Covasim): a model for exploring coronavirus dynamics and interventions
https://covasim.org
MIT License
250 stars 223 forks source link

Move prognoses into pars to allow users to specify them during model setup #246

Closed skroiss-idm closed 4 years ago

skroiss-idm commented 4 years ago

The prognoses are currently hard coded into the get_prognoses function in parameters.py. A better option would be to move those definitions into the pars section in make_pars. This would allow users to specify those variables during model initialization.

Specific recommendation is to add these lines within make_pars: `

Set disease prognoses

pars['prognoses_noage'] = dict(
    age_cutoffs=np.array([0]),
    symp_probs=np.array([0.75]),
    severe_probs=np.array([0.20]),
    crit_probs=np.array([0.08]),
    death_probs=np.array([0.02]),
)

pars['prognoses_byage']  = dict(
    age_cutoffs     = np.array([0,       10,      20,      30,      40,      50,      60,      70,      80,      90, ]),  # Age cutoffs (lower limits)
    sus_ORs         = np.array([1.0,     0.0,     0.0,     0.0,     0.0,     0.0,     0.0,     0.0,     0.0,     0.0]),  # Odds ratios for relative susceptibility -- from https://science.sciencemag.org/content/early/2020/05/04/science.abb8001; 10-20 and 60-70 bins are the average across the ORs
    trans_ORs       = np.array([1.00,    1.00,    1.00,    1.00,    1.00,    1.00,    1.00,    1.00,    1.00,    1.00]),         # Odds ratios for relative transmissibility -- no evidence of differences
    comorbidities   = np.array([1.00,    1.00,    1.00,    1.00,    1.00,    1.00,    1.00,    1.00,    1.00,    1.00]),         # Comorbidities by age -- set to 1 by default since already included in disease progression rates
    symp_probs      = np.array([0.50,    0.55,    0.60,    0.65,    0.70,    0.75,    0.80,    0.85,    0.90,    0.90]),         # Overall probability of developing symptoms (based on https://www.medrxiv.org/content/10.1101/2020.03.24.20043018v1.full.pdf, scaled for overall symptomaticity)
    severe_probs    = np.array([0.00050, 0.00165, 0.00720, 0.02080, 0.03430, 0.07650, 0.13280, 0.20655, 0.24570, 0.24570]), # Overall probability of developing severe symptoms (derived from Table 1 of https://www.imperial.ac.uk/media/imperial-college/medicine/mrc-gida/2020-03-16-COVID19-Report-9.pdf)
    crit_probs      = np.array([0.00003, 0.00008, 0.00036, 0.00104, 0.00216, 0.00933, 0.03639, 0.08923, 0.17420, 0.17420]), # Overall probability of developing critical symptoms (derived from Table 1 of https://www.imperial.ac.uk/media/imperial-college/medicine/mrc-gida/2020-03-16-COVID19-Report-9.pdf)
    death_probs     = np.array([0.00002, 0.00006, 0.00030, 0.00080, 0.00150, 0.00600, 0.02200, 0.05100, 0.09300, 0.09300]),  # Overall probability of dying (https://www.imperial.ac.uk/media/imperial-college/medicine/sph/ide/gida-fellowships/Imperial-College-COVID19-NPI-modelling-16-03-2020.pdf)
)`

Then replace the associated lines in get_prognoses with: if not by_age: prognoses = pars['prognoses_noage'] else: prognoses = pars['prognoses_byage']

cliffckerr commented 4 years ago

Should already be possible -- example solution:

prognoses = cv.get_prognoses()
prognoses['comorbidities'] = np.array([1.00,    1.00,    1.00,    1.00,    1.00,    1.00,    1.00,    2.00,    3.00,    4.00])
pars = {'prognoses': prognoses}
sim = cv.Sim(pars)