Reproducing Allen et al. 2020

This notebook runs the simulation model and reproduces the three figures from the original study.

Please refer to the README.md file for further description of the model, set-up and reproduction.

Running the model

Import required packages.

# Packages for model
import sim.sim_replicate as sim
from sim.parameters import Scenario

# Additional package to record runtime of this notebook
import time
start = time.time()

Set parameters for simulation.

# Scenario
scenarios = {}
scenarios['base_3_month'] = Scenario(
    run_length=150,
    proportion_pos_requiring_inpatient=0.6)

# Number of replications
number_of_replications = 30

# Base number for creation of random number sets
base_random_set = 2700

Run simulation. In the order that these appear, these figures are the attempted reproductions of Figure 2, 3 and 4 respectively from the paper.

# Run the simulation
sim.run_replications(
    scenarios, number_of_replications, base_random_set)
Running 30 reps of base_3_month => 0, 1, 3, 12, 13, 6, 15, 4, 5, 11, 7, 8, 14, 16, 10, 9, 2, 18, 19, 17, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, Done.

# Find run time in seconds
end = time.time()
runtime = round(end-start)

# Display converted to minutes and seconds
print(f'Notebook run time: {runtime//60}m {runtime%60}s')
Notebook run time: 1m 3s