The point of this model is to tell what proportion of the population falls into these four states: [Susceptible, Infectious, Recovered, Dead]. The Python program that does the calculations is available at https://repl.it/@clzirbel/SIRDmodel and an R program at https://repl.it/@clzirbel/SIRDmodelR You can read, edit, and run these programs online, there is nothing to install.
Note that this is an overly simple model, because the probability of a Susceptible person becoming Infectious does not depend on the proportion of the population that is currently Infectious. But it might be the best model to try to understand first, because the time dependent model is more complicated.
The vector mu tells the starting proportions in the population, almost all susceptible, just a few who are infectious, and zero recovered, zero dead.
The “transition matrix” P tells what happens to each person in the population each day, how they can randomly change from one state to another. Row 0 of P tells what happens to a Susceptible person; with a high probability, they stay Susceptible, but with a low probability they become Infectious. Row 1 of P tells what happens to an Infectious person; with a high probability they stay Infectious, because the infection lasts a few weeks, but if not, they make a transition to Recovered or Dead. Rows 2 and 3 of P are simpler; once Recovered, you stay Recovered (you could change that to model a disease where people slowly lose immunity over time and become Susceptible again). Once Dead you stay Dead, and that is the sad part of the reality that we are modeling.
Key parameters need to be set to specify the transition matrix. This is where we need appropriate data from observations. I’m just using guesses:
a = 0.01 # daily probability of a Susceptible person becoming Infectious. This is the parameter we have the most control over with the way we live our lives. Note: there is only one value of this parameter for the whole population being modeled. No personal variation, and it does not change over time. See below for a better model.
b = 14/15 # daily probability of an Infectious person staying Infectious, as opposed to moving to Recovered or Dead. On average they’ll stay Infectious for 15 days.
c = 0.0115 # probability that a person who leaves the Infectious state dies, as opposed to moving to the Recovered state. This is the infection fatality rate that you can read about at https://www.imperial.ac.uk/mrc-global-infectious-disease-analysis/covid-19/report-34-IFR/
See the graph below.