remove (list = objects() )

Load add-on packages - deSolve - contains lsoda function - differential equation solver.

library (deSolve)
## 
## Attaching package: 'deSolve'
## 
## The following object is masked from 'package:graphics':
## 
##     matplot

Function to compute derivatives of the differential equations.

sis_model = function (current_timepoint, state_values, parameters)
{
  # create state variables (local variables)
  Sm = state_values [1]        # susceptible men
  Im = state_values [2]        # infectious men
  Sw = state_values [3]        # susceptible women
  Iw = state_values [4]        # susceptible women

  with ( 
    as.list (parameters),     # variable names within parameters can be used 
         {
           # compute derivatives
           dSm = (-beta_mw * Sm * Iw) + (gamma * Im)
           dIm = ( beta_mw * Sm * Iw) - (gamma * Im)
           dSw = (-beta_wm * Sw * Im) + (gamma * Iw)
           dIw = ( beta_wm * Sw * Im) - (gamma * Iw)
           
           
           # combine results
           results = c (dSm, dSw, dIm, dIw)
           list (results)
         }
    )
}

Parameters

contact_rate_mw = 0.137               # number of contacts per day men to women
contact_rate_wm = 0.137               # number of contacts per day women to men
transmission_probability_mw = 0.05    # transmission probability men to women
transmission_probability_wm = 0.1     # transmission probability women to men
infectious_period = 365               # infectious period

Compute values of beta (transmission rate) and gamma (recovery rate).

beta_value_mw = contact_rate_mw * transmission_probability_mw
beta_value_wm = contact_rate_wm * transmission_probability_wm
gamma_value = 1 / infectious_period

Compute Ro - Reproductive number.

Rom = beta_value_mw / gamma_value
Row = beta_value_wm / gamma_value

Disease dynamics parameters.

parameter_list = c (beta_mw = beta_value_mw, beta_wm = beta_value_wm, gamma = gamma_value)

Initial values for sub-populations.

Xm = 10000       # susceptible men
Xw = 11000       # susceptible women
Ym = 1           # infectious men
Yw = 1           # infectious women

Compute total population.

N = Xm + Xw + Ym + Yw

Initial state values for the differential equations.

initial_values = c (Sm = Xm/N, Sw = Xw/N, Im = Ym/N, Iw = Yw/N)

Output timepoints.

timepoints = seq (0, 10, by=1)

Simulate the SIS epidemic.

output = lsoda (initial_values, timepoints, sis_model, parameter_list)

Plot dynamics of Susceptible Men sub-population.

plot (Sm ~ time, data = output, type='b', col = 'blue')

Plot dynamics of Infectious Men sub-population.

plot (Im ~ time, data = output, type='b', col = 'purple')   

Plot dynamics of Susceptible Women sub-population.

plot (Sw ~ time, data = output, type='b', col = 'orange') 

Plot dynamics of Infectious Women sub-population.

plot (Iw ~ time, data = output, type='b', col = 'green')  

Plot dynamics of Susceptibles and Infectious sub-populations in the same plot.

# susceptible men hosts over time
plot (Sm ~ time, data = output, type='b', ylim = c(0,1), col = 'blue', ylab = 'S, I, S', main = 'SIS epidemic') 

# remain on same frame
par (new = TRUE)

#susceptible women hosts over time
plot (Sw ~ time, data = output, type='b', ylim = c(0,1), col = 'orange', ylab = 'S, I, S', main = 'SIS epidemic') 

#remain on same frame
par (new = TRUE)

# infectious men hosts over time
plot (Im ~ time, data = output, type='b', ylim = c(0,1), col = 'purple', ylab = '', axes = FALSE) 

#remain on same frame
par (new = TRUE)

#infectious women hosts over time
plot (Iw ~ time, data = output, type='b', ylim = c(0,1), col = 'green', ylab = '', axes = FALSE)

In a Susceptible Infectious Susceptible epidemiological model, a susceptible host can become infectious and can immediately reutrn to becoming susceptible once again. This model computes, analyzes, and illustrates the numbers of susceptible men (blue) and women (orange) as well as infectious men (purple) and women (green) hosts over time. As time progresses, in both the populations of men and women, as the number of infectious hosts increase, the number of susceptible host decrease. .