add prior immunity examples
{
"cell_type": "markdown",
"source": [
- "In this example there isn't a large difference in the epidemic dynamics, because over a short run-time (120 days) immunity doesn't wane very much, so boosters don't have a large effect. However, this example can be adapted to longer run-times, where boosters have a larger impact."
+ "In this example there isn't a large difference in the epidemic dynamics, because over a short run-time (120 days) immunity doesn't wane very much, so boosters don't have a large effect. However, this example can be adapted to longer run-times, where boosters have a larger impact.\n",
+ "\n",
+ "### Prior immunity methods\n",
+ "\n",
+ "The longer that the COVID-19 pandemic persists, the less feasible/desirable it becomes to simulate the entire ~2 year history of the epidemic. However, starting simulations 1-2 years into the pandemic is also not ideal, as this will fail to capture the pre-existing immunity profile of the population. A good alternative is to use the `cv.prior_immunity` method. The following example starts a simulation in which 50% of the population are assumed to be vaccinated with the Pfizer vaccine 360 days before the simulation begins:"
],
"metadata": {
"collapsed": false
}
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "outputs": [],
+ "source": [
+ "pfizer = cv.historical_vaccinate_prob(vaccine='pfizer', days=[-360], prob=0.5)\n",
+ "sim = cv.Sim(pars={'n_days':1}, interventions=pfizer, use_waning=True,\n",
+ " analyzers=cv.nab_histogram(days=[0], edges=np.linspace(-4,2,12+1)))\n",
+ "sim.run()\n",
+ "\n",
+ "sim['analyzers'][0].plot()"
+ ],
+ "metadata": {
+ "collapsed": false,
+ "pycharm": {
+ "name": "#%%\n"
+ }
+ }
+ },
+ {
+ "cell_type": "markdown",
+ "source": [
+ "The histogram of neutralizing antibody levels after 1 day of simulation shows that there are already significant levels of immunity in the population.\n",
+ "\n",
+ "This next example will initialize the population with immunity levels corresponding to a prior wave of infections peaking 120 days before the simulation starts, with 5% of the population having been infected:"
+ ],
+ "metadata": {
+ "collapsed": false
+ }
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "outputs": [],
+ "source": [
+ "intv = cv.prior_immunity(120, 0.05)\n",
+ "cv.Sim(pars={'use_waning':True}, interventions=intv).run().plot()"
+ ],
+ "metadata": {
+ "collapsed": false,
+ "pycharm": {
+ "name": "#%%\n"
+ }
+ }
}
],
"metadata": {
