You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository contains code for an SIR model with a random walk over the $\beta$ parameter. The code simulates an epidemic using a sample random walk and then uses turing.jl to infer the chosen model parameters from the simulated data.
Model definitions
Note that all distributions (except where specified) are parameterised as their default parameterisations in Distributions.jl.
SIR Model
To begin the SIR model chosen is defined as the following:
$$
\begin{align*}
\frac{dS}{dt} &= - \frac{\beta(t) S I }{N}, \\
\frac{dI}{dt} &= \frac{\beta(t) S I }{N} - \gamma I ,\\
\frac{dR}{dt} &= \gamma I.
\end{align*}
$$
In the case of this model $\beta(t)$ is allowed to vary according to a random walk over $\log(\beta)$. This is written as the following (for some sequence of $\beta_k$ where $k$ indexes the sequence):
Here, $\delta_t$ is the timesteps when the results are saved rather than the timesteps used as part of the ODE solver. Additionally $\delta_\beta$ is the time between the iterations of the random walk. This selected value leads to two $\beta$ values one for the first $40$ days of the model and another for the final $40$ days. The $\beta$ values for the data are drawn from the random walk described in equation~\ref{eq:beta_rw}.
To perform inference observations were drawn from the model, where we draw a sample from a proportion of the number of daily recovered individuals:
Here $\epsilon$ is some small constant (currently $1e-3$) used for stability. In particular this is added as due to the numerical computational methods it is possible for $\Delta_R(t)$ to be negative, (usually these estimates will be automatically rejected), but this allows the distribution to produce samples in the case the numerical error is negligible. The Negative Binomial distribution is parameterised by:
$$
Y \sim \text{NegativeBinomial}(\mu,\phi),
$$
where $\mathbb{E}(Y) = \mu$ and $\text{Var}(Y)=\mu (1-\phi)$.
Priors
The parameters to be estimated in this simple model are $\beta$ and $I_0$ (the initial number of infected individuals. The $\beta_k$ terms use the same priors as their generative distribution. This can be written: