Closed DavAug closed 3 years ago
As disussed it is probably best to avoid adding an additional state variable and compute n_incidence
from I and R. For times = [t_0, t_1, ... , t_f] n_incidence
can be computed as
total_infected = i + r
n_incidence = total_infected[1:] - total_infected[:-1]
i.e. [total_infected[t_1] - total_infected[t_0], [total_infected[t_2] - total_infected[t_1], ... ]
Looking at the exercise sheet, epidemiological models like the SEIR model are often used to simulate the number of infections in a given time unit (often days). At the moment we are just returning the states (S, E, I, R), but the incidence number is the influx to I from time t_i to t_f, say from Tuesday to Wednesday. To be able to return the number of incidences we have to slightly modify the simulate function.
return_incidence
to simulate which by default assumes the valueFalse
._right_hand_side
method to additionally compute the incidence number (i.e.n_incidence
which is called C on the exercise sheet) by just extending the states (S, E, I, R) to (S, E, I, R, n_incidence). The right hand side of n_incidence isreturn_incidence
is False, return the simulated S, E, I, R values as before.return_incidence
is True, execute a private method_compute_incidences
that returns the number of new cases between the provided times.