Skip to content

Commit bd2a7cd

Browse files
committed
add old and new sceanrio_sim API to epi-community-contrib post
1 parent f5acabc commit bd2a7cd

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

posts/epi-community-contrib/index.qmd

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,67 @@ In the recent months Epiverse has collaborated with {ringbp} developers Seb Funk
3333

3434
The user experience (API) of the package has been refactored. The main simulation function `scenario_sim()` remains, but its arguments have been modularised to better group model parameters and control arguments. This also makes the package easier to develop further without necessarily introducing many breaking changes and prevents the number of top-level function arguments from expanding.
3535

36+
:::: {.columns}
37+
38+
::: {.column width="47.5%"}
39+
**Old**
40+
41+
``` r
42+
scenario_sim(
43+
n.sim = 5,
44+
num.initial.cases = 5,
45+
cap_max_days = 365,
46+
cap_cases = 2000,
47+
r0isolated = 0,
48+
r0community = 2.5,
49+
disp.iso = 1,
50+
disp.com = 0.16,
51+
k = 0.7,
52+
delay_shape = 2.5,
53+
delay_scale = 5,
54+
prop.asym = 0,
55+
prop.ascertain = 0
56+
)
57+
```
58+
:::
59+
60+
::: {.column width="5%"}
61+
<!-- empty column to create gap -->
62+
:::
63+
64+
::: {.column width="47.5%"}
65+
66+
**New**
67+
68+
``` r
69+
scenario_sim(
70+
n = 5,
71+
initial_cases = 5,
72+
offspring = offspring_opts(
73+
community = \(n) rnbinom(n = n, mu = 2.5, size = 0.16),
74+
isolated = \(n) rnbinom(n = n, mu = 0, size = 1),
75+
asymptomatic = \(n) rnbinom(n = n, mu = 2.5, size = 0.16)
76+
),
77+
delays = delay_opts(
78+
incubation_period = \(n) rweibull(n = n, shape = 2.32, scale = 6.49),
79+
onset_to_isolation = \(n) rweibull(n = n, shape = 2.5, scale = 5)
80+
),
81+
event_probs = event_prob_opts(
82+
asymptomatic = 0,
83+
presymptomatic_transmission = 0.3,
84+
symptomatic_ascertained = 0
85+
),
86+
interventions = intervention_opts(quarantine = TRUE),
87+
sim = sim_opts(
88+
cap_max_days = 365,
89+
cap_cases = 2000
90+
)
91+
)
92+
```
93+
:::
94+
95+
::::
96+
3697
The new API gives the user more control over the model's parameterisation. The incubation period is now specified by the user instead of being set to an estimate for COVID-19. The way offspring and delay distribution functions are specified also means that any distributional or non-parametric form can be supplied, relaxing the assumption that the onset-to-isolation has to be a Weibull distribution.
3798

3899
Users can now specify the proportion of presymptomatic transmission rather than having to understand the skew normal parameterisation used by the simulation model, making it easier to get started with the package for new users.

0 commit comments

Comments
 (0)