Impute Recovered counts for the SIR model

cases_to_SIR(data, par, method = "chain-binomial")

Arguments

data

data frame or grouped data frame with the following columns

t

time

confirmed

number of cumulative confirmed cases at time t in the group

N

population size, which is used as the number of susceptible (minus the initial infections)

par

named vector of parameters

method

Currently default is "chain-binomial". See details. More methods to come.

Value

the input data with the additional columns

X0

number of susceptible

X1

number of infectious

X2

number of recovered

Details

For the method "chain-binomial". Let the cumulative case counts at time \(t\) be \(J_t\). Then the number of susceptibles is simply \(S_t = N - J_t\). The number of infectious and recovered is imputed iteratively using random draws from a chain binomial based on the state sizes at the previous time step. Specifically, we assume \(I_{t_0} = J_{t_0}\) and \(R_{t_0} = 0\), that is the initial number of recovered individuals is zero. Then for each \( t \in \{ t_0 + 1, t_0 + 2, \dots, T\}\) \(R_t = R_{t-1} +\) Binomial\((I_{t-1}, \gamma)\) and \(I_t = J_t - R_t\). Here \((X0, X1, X2) = (S, I, R)\).

Examples

df <- data.frame(t = 0:4, confirmed = c(0, 1, 3, 9, 9), N = 10) out <- cases_to_SIR(data = df, par = 1)