SIR Model Epidemic Calculator

Simulate susceptible, infected, and recovered populations with a deterministic infectious disease model.

SIR epidemic simulation
Enter initial compartments, daily transmission and recovery rates, and a simulation duration.

Understanding the SIR epidemic model

The SIR model is a foundational mathematical framework for exploring infectious disease spread. It divides a closed population into three compartments: susceptible people who can acquire the infection, infected people who can transmit it, and recovered people who are assumed to be immune and no longer infectious. The initials S, I, and R give the model its name. At every step, people move from susceptible to infected and then from infected to recovered; the total population remains constant. Transmission is represented by beta. During each simulated day, new infections equal beta multiplied by susceptible people and infected people, divided by the total population. Recovery is represented by gamma, and new recoveries equal gamma multiplied by the infected population. The corresponding differential equations are dS/dt = -beta SI/N, dI/dt = beta SI/N - gamma I, and dR/dt = gamma I. This calculator approximates those continuous equations with one-day Euler steps and prevents a daily flow from exceeding its source compartment. The ratio beta divided by gamma is the basic reproduction number in the simplest SIR assumptions. A value above one indicates that infection can initially grow when nearly everyone is susceptible, while a value below one indicates decline. As susceptible people are depleted, the effective reproduction number falls and an epidemic can peak even if the basic value is greater than one. The reported peak shows the largest simulated infected compartment and the day it occurs. Final compartment sizes describe the modeled state at the chosen horizon, not necessarily the ultimate end of an outbreak. Real epidemics rarely satisfy all SIR assumptions. Populations have age groups, contact networks, births, deaths, migration, vaccination, behavior changes, varying infectious periods, underreporting, and reinfection. Beta and gamma can also change over time. A one-day numerical step is useful for learning and quick scenarios but is less precise than a smaller-step numerical solver or a fitted statistical model. Do not use this output as a forecast or a basis for public health decisions. Reliable forecasting requires calibrated data, uncertainty intervals, sensitivity analysis, and review by epidemiologists who understand the pathogen and surveillance system.

SIR model examples

These examples illustrate how transmission and recovery assumptions change an epidemic curve.

Starting scenarioExpected patternInterpretation
N 10,000; S 9,990; I 10; beta 0.3; gamma 0.1; 100 daysInitial growth with R0 of 3Illustrative community outbreak
N 1,000; S 990; I 10; beta 0.08; gamma 0.1; 60 daysInfections generally declineR0 below 1
N 50,000; S 39,990; I 10; R 10,000; beta 0.2; gamma 0.1Slower growth than a fully susceptible populationPreexisting immunity reduces effective spread

How to run an SIR simulation

  1. Enter a total population and initial susceptible, infected, and recovered counts that add to that total.
  2. Enter daily transmission and recovery rate assumptions as decimals.
  3. Choose the number of whole days to simulate.
  4. Run the model and compare final compartments, peak infections, and the reproduction number.

SIR model FAQ

What do beta and gamma mean?

Beta controls the rate of potentially infectious contact in this simple model. Gamma is the daily recovery rate, so its reciprocal approximates the average infectious duration.

What does an R0 above one indicate?

Under the model's assumptions, each infected person initially produces more than one new infection on average. It indicates potential growth, not a guaranteed forecast.

Why must the three compartments equal the population?

Every person in a closed SIR population must occupy exactly one compartment. A mismatch would create or omit people and violate conservation in the equations.

Does the model include vaccination or reinfection?

This basic version includes neither a vaccination flow nor loss of immunity. More advanced compartment models can add those mechanisms.

How accurate is the one-day simulation?

Daily Euler steps provide a transparent approximation for learning and scenario comparison. Research or policy work should use calibrated models, finer numerical methods, and uncertainty analysis.