SIR Model

C.G.
5-13-22

Im,V,S,I,D,R Buckets

SIR Buckets

Variables

  • n = population
  • S = Susceptible population
  • I = Infected population
  • R = Recovered population
  • beta = How the susceptible and infected population interact
  • gamma = How the infected and recovered population interact
  • beta and gamma are found by observing the population

SIR Model

The SIR model is used by epidemiologists

  • Initial conditions

  • Note that n is population

  • Uses a system of differential equations

  • We know know the Susceptible, Infected, and Recovered populations at time zero
  • We also know how those numbers will change over a given time.

SIR Model Cont. Finding the Next Step

  • To find the populations at a given time after zero we will use the equations below,

Octave Code I

beta = .0005;    # Beta coefficient.
gamma = .00048;   # Gamma coefficient.
dt = 0.5;    # Change in time.  
N = 1000;     # Number of times the equations will update.

# Time vector
t = linspace(0, N*dt, N+1);

# Zero vectors for S, I, R
S = zeros(N+1, 1);
I = zeros(N+1, 1);
R = zeros(N+1, 1);

Octave Code II

# Initial condition
S(1) = 100;
I(1) = 1;
R(1) = 0;

# The forward equations used to find futier values of S, I, R
for n = 1:N
   S(n+1) = S(n) - dt*beta*S(n)*I(n); 
   I(n+1) = I(n) + dt*beta*S(n)*I(n) - dt*gamma*I(n);
   R(n+1) = R(n) + dt*gamma*I(n);
end

# Ploting the S, I, R graph (I should be a graph but for some reason it prints 3)
plot(t, S, t, I, t, R);
legend('S', 'I', 'R', 'Location','northeast');
xlabel('time');
ylabel('S, I, R Populations')
print('tmp', '-dpdf');  print('tmp', '-dpng');

Octave Code Output

Octave Code Output

Results

The Program runs for small beta and small gamma however for real values it brakes and it prints three graphs…

Works Cited