This code replicates Figure 6 in Berger, Herkenhoff, Mongey (2020) - *An SEIR Infectious Disease Model with Testing and Conditional Quarantine".

To replicate this figure for a number of different rates of testing $\left(\tau\right)$ follow these instructions:

- Scroll down to the first 'cell' below, place cursor inside the cell, then press Ctrl+Enter.
- This will compile some code and present the baseline calibration of the model
- Ignore these if you wish to replicate Figure 6

- Click the button marked
**[Run model]**- The code will take ~45-90s to run the model, and then display
**"Done solving model"**

- The code will take ~45-90s to run the model, and then display
- Click the button marked
**[Show panel chart]**to display the figure- Accompanying the figure will be a slider for $\tau \in [0,0.05]$ (from zero to 10 times the value used in the paper), that can be moved to change the plot

Below we describe other parameters. To change other parameters refresh this page in your browser. Repeat the above and then before pressing **[Run model]**, choose alternative values for model parameters.

**To download the underlying code, please follow the link to 'Download underlying model files' at http://www.simonmongey.com, or alternatively access the files at http://www.github.com/simonmongey/covidtesting. This code can be ran, more quickly and offline using Jupyter Notebook**

- There are two sets of parameters that the user can change

The first set appear in Table 4 of the paper, and below are divided into three blocks

**Quarantine parameters**- $\xi^u\geq 0$
- Baseline rate of quarantine that is used in the
*Common quarantine*case

- Baseline rate of quarantine that is used in the
- $\lambda^Q/\lambda\in[0,1]$
- Effectiveness of quarantine. If equal to 1, then quarantine has no effect. We suggest in the paper that for Wuhan this is around 0.10, and use 0.50 as our baseline for counterfacutals

- $A_{rel}\in[0,1]$
- Relative productivity of asymptomatic quarantined individuals to asymptomatic non-quarantined individuals. $$ Y_t = M_t^{A,NQ} + A_{rel}\times M_t^{A,Q} $$
- If this is lower, then
*Common quarantine*policy will lead to larger declines in output relative to*Targeted quarantine*policies.

- $\xi^u\geq 0$
**Disease parameters**- Number of initial infections in the US population
- $\pi^D$
- Rate at which
*symptomatic*individuals die from the virus.

- Rate at which

**Timing parameters**- Date of vaccine - In the paper we set this to 500 days
- $1/\delta$
- Gives the number of days that it takes, on average, to show symptoms once infected with the virus

- $1/\omega^R$
- Gives the number of days that it takes, on average, to recover from the virus

**Contagion parameters**- $R_0$
- This is the baseline transmission rate. In the code $\rho^S$---the probability of infection conditional on meeting---is chosen to imply this level of $R_0$
- $\rho^A/\rho^S$

- This is measures the relative infectiousness of asymptomatic individuals. A meeting with a symptomatic individual results in infection with probability $\rho^S$. If $\rho^A/\rho^S=0.5$, then half as many meetings with asymptomatic individuals result in infection. In the paper we simply set this to 1.

- This is the baseline transmission rate. In the code $\rho^S$---the probability of infection conditional on meeting---is chosen to imply this level of $R_0$

- $R_0$

The second set appear in Tables 5 and 6 of the paper, these are the very simply 'policy parameters' $\tau\geq 0$ and $\Delta\in[0,1]$ which represent the rate of daily testing and the slackening of quarantine measures that we use to construct our counterfactual.

- Chooses one of the two parameters to
*Slide over* - Set the range for the other parameter.
- When sliding over $\Delta$, the
*upper value*is always 1, which represents no slackening of quarantine. User then chooses the*lower bound*. - When sliding over $\tau$, the
*lower value*is always 1, which represents no testing. User then chooses the*upper bound*. - In both cases the grid of parameters that are considered is evenly spaced and has 10 points.

- When sliding over $\Delta$, the
- Proceed as above: Click
**[Run model]**, wait until it displays**"Done solving model"**, then click**[Show panel chart]**

In [ ]:

```
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# INSTRUCTIONS: Click to place cursor in this box, and then press Ctrl+Enter
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
from IPython.display import Javascript
Javascript("Jupyter.notebook.execute_cells([3,4,5,6])")
```

In [ ]:

```
from model_code import *
from jupyterWidgets import *
```

In [ ]:

```
# Toggle on/off the raw code
from IPython.display import HTML
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.input').hide();
} else {
$('div.input').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
<form action="javascript:code_toggle()"><input type="submit" value="Click here to switch on/off the raw code"></form>''')
```

In [ ]:

```
display(paramsPanel)
```

In [ ]:

```
display(run_box)
```

In [ ]:

```
τ_list = np.arange(0., τ_max.value + τ_step.value, τ_step.value)
Δ_list = np.arange(Δ_min.value, 1. + Δ_step.value, Δ_step.value)
if slide_var.value == 1:
f = generate_plots(Δ.value, τ_list, ξ_base.value, A_rel.value, d_vaccine.value*14+3*14, \
rel_ρ.value, δ_param.value, ωR_param.value, π_D.value, \
R_0.value, rel_λ.value, initial_infect.value, slide_var.value)
elif slide_var.value == 2:
f = generate_plots(Δ_list, τ.value, ξ_base.value, A_rel.value, d_vaccine.value*14+3*14, \
rel_ρ.value, δ_param.value, ωR_param.value, π_D.value, \
R_0.value, rel_λ.value, initial_infect.value, slide_var.value)
print("Done solving model.")
```

In [ ]:

```
f
```