Skip to content

Commit 28f0ff2

Browse files
committed
simplying approach.md
1 parent 26e9975 commit 28f0ff2

File tree

2 files changed

+13
-31
lines changed

2 files changed

+13
-31
lines changed

docs/approach.md

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,46 @@
11
# Using Next Generation Matrices
22

3-
The NGM for a 4-Group Infectious Disease Model with compartments $S_g$, $I_g$, $R_g$: Susceptible, Infected, and Recovered compartments in the $G$ groups $g = 1, \dots, G$. Where possible we try to be general, otherwise we will take $G = 4$
3+
The NGM for a 4-Group Infectious Disease Model with compartments $S_i$, $I_i$, $R_i$: Susceptible, Infected, and Recovered compartments.
44

5-
Dynamics for $I_g$ in each group given by:
5+
Dynamics for $I_i$ in each group given by:
66

77
$$
8-
\frac{d I_g}{dt} = \sum_{j} \frac{\beta_{jg} S_j I_j}{N_j} - \gamma_g I_g
8+
\frac{d I_i}{dt} = \sum_{j} \frac{\beta_{ij} S_i I_j}{N_j} - \gamma_i I_i
99
$$
1010

1111
where:
1212

13-
- $\beta_{jg}$: Transmission rate from group $j$ to group $g$,
13+
- $\beta_{ij}$: Transmission rate from group $j$ to group $i$,
1414
- $S_j$: Susceptible population in group $j$,
1515
- $N_j$: Total population in group $j$,
16-
- $\gamma_g$: Recovery rate in group $g$.
16+
- $\gamma_i$: Recovery rate in group $i$.
1717

1818
The NGM is calculated at the disease free equilibrium (DFE) where
1919

2020
$$
21-
I_g = 0, S_g = N_g \ \text{for all\ } g
21+
I_i = 0, S_i = N_i \ \text{for all\ } i
2222
$$
2323

24-
---
25-
2624
And then the NGM `R` is given by:
2725

2826
$$
29-
\mathbf{R} = \mathbf{F} \mathbf{V}^{-1}
30-
$$
31-
32-
where $\mathbf{F}$ is the matrix of new infections and $\mathbf{V}$ is the matrix of transitions between compartments, not representing new infections.
33-
34-
The elements of $\mathbf{F}$ are
35-
36-
$$
37-
\mathbf{F}_{ij} = \frac{\beta_{ij} S_{j}}{N_{j}}
27+
\mathbf{R}_{ij} = \frac{\beta_{ij} S_{i}}{\gamma N}
3828
$$
3929

40-
while $\mathbf{V}$ is a diagonal matrix with $\mathbf{V}_{ii} = \gamma$ where the recovery rate is shared among all groups $g$.
41-
42-
Since $\mathbf{V}$ is diagonal, its inverse is as well, with $(\mathbf{V}^{-1})_{ij} = 1 / \gamma_i$.
43-
44-
If all $\gamma_i = \gamma$, $\mathbf{R}$ is given by
45-
46-
$$
47-
\mathbf{R}_{ij} = \frac{\beta_{ij} S_{j}}{\gamma N_{j}}
48-
$$
30+
If all $\gamma_i = \gamma$ and we assume SIR dynamics.
4931

5032
The basic reproductive number $R_0$ is calculated as the dominant eigenvalue of $R$.
5133

52-
This model incorporates vaccination by recalculating the distribution of susceptible individuals $S_g / N_g$ when $v_g$ vaccinations have been administered to each group $g$ (assuming all or nothing vaccination, with vaccine efficacy given by $ve$):
34+
This model incorporates vaccination by recalculating the distribution of susceptible individuals in each group $S_{i}^{vax}$ (assuming all or nothing vaccination, with vaccine efficacy given by $ve$):
5335

5436
$$
55-
\mathbf{S_{g}^{vax}} = S_{g}^{initial} - v_{g} * ve
37+
\mathbf{S_{i}^{vax}} = S_{i}^{initial} * (1 - v_{i} * ve)
5638
$$
5739

5840
Then $R_ij$ with vaccination factored in is given by
5941

6042
$$
61-
\mathbf{R}_{ij}^{vax} = \frac{\beta_{ij} S_{j}^{vax}}{\gamma N_{j}^{vax}}
43+
\mathbf{R}_{ij}^{vax} = \frac{\beta_{ij} S_{i}^{vax}}{\gamma N}
6244
$$
6345

6446

widget/widget.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ def app():
1717

1818
# Population size
1919
st.sidebar.subheader("Population Sizes")
20-
default_values = [100, 100, 50, 1000]
20+
default_values = np.array([0.2, 0.2, 0.005, 0.595]) * 1000000
2121
N = np.array(
2222
[
23-
st.sidebar.number_input(f"Population ({group})", value=default_values[i], min_value=0)
23+
st.sidebar.number_input(f"Population ({group})", value=int(default_values[i]), min_value=0)
2424
for i, group in enumerate(group_names)
2525
]
2626
)

0 commit comments

Comments
 (0)