This model allows for the simulation of an ID with 2 types of hosts

simulate_heterogeneity_ode(
S1 = 1000,
I1 = 1,
S2 = 1000,
I2 = 0,
b11 = 0.01,
b12 = 0,
b21 = 0,
b22 = 0,
g1 = 1,
g2 = 1,
w1 = 0,
w2 = 0,
tmax = 120
)

## Arguments

S1 : initial number of susceptible type 1 hosts : numeric : initial number of infected type 1 hosts : numeric : initial number of susceptible type 2 hosts : numeric : initial number of infected type 2 hosts : numeric : rate of transmission from infected type 1 host to susceptible type 1 host : numeric : rate of transmission from infected type 1 host to susceptible type 2 host : numeric : rate of transmission from infected type 2 host to susceptible type 1 host : numeric : rate of transmission from infected type 2 host to susceptible type 2 host : numeric : the rate at which infected type 1 hosts recover : numeric : the rate at which infected type 2 hosts recover : numeric : the rate at which type 1 host immunity wanes : numeric : the rate at which type 2 host immunity wanes : numeric : maximum simulation time, units of months : numeric

## Value

This function returns the simulation result as obtained from a call to the deSolve ode solver.

## Details

A compartmental ID model with several states/compartments is simulated as a set of ordinary differential equations. The function returns the output from the odesolver as a matrix, with one column per compartment/variable. The first column is time.

## Warning

This function does not perform any error checking. So if you try to do something nonsensical (e.g. any negative values or fractions > 1), the code will likely abort with an error message.

## References

See e.g. Keeling and Rohani 2008 for SIR models and the documentation for the deSolve package for details on ODE solvers

  # To run the simulation with default parameters just call the function:
plot(result$ts[,"time"],result$ts[,"S1"],xlab='Time',ylab='Number Susceptible 1',type='l')