Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compartmental models #15

Open
4 tasks
pawel-czyz opened this issue Nov 11, 2024 · 1 comment
Open
4 tasks

Compartmental models #15

pawel-czyz opened this issue Nov 11, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@pawel-czyz
Copy link
Member

pawel-czyz commented Nov 11, 2024

@dr-david We discussed using compartmental models a few times, I've decided to write it down here, so I don't forget the equations.

There are several compartmental models.
Two of them are described at the end of this issue.
Using Diffrax we can implement them and model how the fraction of particular variant changes over the time, i.e.,

$$y_k(t) = \frac{i_k(t)}{i_1(t) + \cdots + i_V(t)}$$

and see how well the logistic growth approximates this dynamics over the time.
Note that we can:

  1. Solve the model in terms of the usual fractions of the population, and then calculate the proportions $y_k$ just from the data.
  2. We can even try to fit the model in the Bayesian manner, backpropagating the gradients through and ODE with Diffrax. Note that, however, this model is not identifiable.

SIR model

In this model, we have functions $s$ and $r$ representing susceptible and recovered (immune) fraction of the population, as well as fraction of population infected with variant $k$, $i_k$, for $k=1, \dotsc, V$.

$$s' = -s( \beta_1 i_1 + \cdots + \beta_V i_V )$$ $$i'_k = \beta_k i_k s - \gamma_k i_k $$ $$r' = \gamma_1 i_1 + \cdots + \gamma_V i_V$$

SIS model

In this model, we do not have the recovered population.

$$s' = -s( \beta_1 i_1 + \cdots + \beta_V i_V ) + (\gamma_1 i_1 + \cdots + \gamma_V i_V)$$ $$i'_k = \beta_k i_k s - \gamma_k i_k $$

Tasks

  • Implement the SIR model in Diffrax.
  • Implement the SIS model in Diffrax.
  • In a notebook (or Snakemake), on simulated data: fit the basic logistic growth model.
  • Fit the compartmental models using NumPyro.
@pawel-czyz pawel-czyz added the enhancement New feature or request label Nov 14, 2024
@pawel-czyz
Copy link
Member Author

These models are, in principle, not compatible with the current logistic growth due to the used theta, which is a single array. This will require defining more flexible growth models. One possible approach to this is in #20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant