This function runs a simulation of a MSEIR model using a set of 6 ordinary differential equations. The user provides initial conditions and parameter values for the system. The function simulates the ODE using an ODE solver from the deSolve package. The function returns a matrix containing time-series of each variable and time.

simulate_maternalimmunity_ode(
S = 1000,
I = 1,
tmax = 1000,
m = 0.02,
n = 0.02,
p = 0.005,
b = 0.3,
gE = 0.1,
gI = 0.02,
w = 0
)

## Arguments

S : initial number of susceptible individuals : numeric : initial number of infected hosts : numeric : maximum simulation time : numeric : rate at which individuals are born : numeric : rate at which individuals die : numeric : rate at which individuals lose passive immunity : numeric : rate of new infections : numeric : rate of leaving latent stage : numeric : rate of recovery : numeric : rate of waning immunity : numeric

## Value

The function returns the output from the odesolver as a matrix, with one column per compartment/variable. The first column is time.

## Details

A simple MSEIR model is simulated as a set of ordinary differential equations, using an ode solver from the deSolve package.

## Warning

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

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