Impute Recovered counts for the SIR model
cases_to_SIR(data, par, method = "chain-binomial")
data | data frame or grouped data frame with the following columns
|
---|---|
par | named vector of parameters |
method | Currently default is "chain-binomial". See details. More methods to come. |
the input data with the additional columns
number of susceptible
number of infectious
number of recovered
For the method "chain-binomial". Let the cumulative case counts at time t be Jt. Then the number of susceptibles is simply St=N−Jt. 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 It0=Jt0 and Rt0=0, that is the initial number of recovered individuals is zero. Then for each t∈{t0+1,t0+2,…,T} Rt=Rt−1+ Binomial(It−1,γ) and It=Jt−Rt. Here (X0,X1,X2)=(S,I,R).
df <- data.frame(t = 0:4, confirmed = c(0, 1, 3, 9, 9), N = 10) out <- cases_to_SIR(data = df, par = 1)