SEIR Model

SEIR model is similar to SIR model, but with exposed state added. This just requires an addition of one more line. One can summarize these with a struct:

E2I = 1;
I2R = 1;
beta_N = 1;

linear.exposed.infectious = E2I;
linear.infectious.recovered = I2R;

interaction.susceptible.infectious.exposed = beta_N;

seir_model = epimodel(linear, interaction);

and set the initial distribution

init_dist.infectious = 1e-4;
init_dist.susceptible = 1 - 1e-4;
seir_model.set_initial_dist(init_dist);

Again, “exposed” and “recovered” states are implicitly set to have zero initial distribution.

seir_model.simulate(10);

simulate for 10 time period.

Finally,

plot(seir_model.time_knots, seir_model.results.susceptible);
title('susceptible');

plot(seir_model.time_knots, seir_model.results.exposed);
title('exposed');

plot(seir_model.time_knots, seir_model.results.infectious);
title('infectious');

plot(seir_model.time_knots, seir_model.results.recovered);
title('recovered');

makes plots.