Skip to content

Commit 80d3980

Browse files
committed
add callout box with only_linelist FALSE reprex
Fix #184
1 parent 9ea7f2b commit 80d3980

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

episodes/superspreading-estimate.Rmd

+42-1
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,54 @@ At `epicontacts::get_degree()` we use the `only_linelist = TRUE` argument.
177177
This is to count the number of secondary cases caused by all the observed infected individuals,
178178
which includes individuals in contacts and linelist data frames.
179179

180-
This assumption may not work for all situations.
180+
:::::::::::::::::::::
181+
182+
::::::::::::::::::::: spoiler
183+
184+
### When to use 'only_linelist = FALSE'?
185+
186+
The assumption that
187+
"the linelist will include all individuals in contacts and linelist"
188+
may not work for all situations.
189+
181190
For example, if during the registry of observed infections,
182191
the contact data included more subjects than the ones available in the linelist data,
183192
then you need to consider only the individuals from the contact data.
184193
In that situation,
185194
at `epicontacts::get_degree()` we use the `only_linelist = FALSE` argument.
186195

196+
Find here a printed [reproducible example](https://reprex.tidyverse.org/):
197+
198+
```r
199+
# Three subjects on linelist
200+
sample_linelist <- tibble::tibble(
201+
id = c("id1", "id2", "id3")
202+
)
203+
204+
# Four infector-infectee pairs with Five subjects in contact data
205+
sample_contact <- tibble::tibble(
206+
from = c("id1","id1","id2","id4"),
207+
to = c("id2","id3","id4","id5")
208+
)
209+
210+
# make an epicontacts object
211+
sample_net <- epicontacts::make_epicontacts(
212+
linelist = sample_linelist,
213+
contacts = sample_contact,
214+
directed = TRUE
215+
)
216+
217+
# count secondary cases per subject from linelist only
218+
epicontacts::get_degree(x = sample_net, type = "out", only_linelist = TRUE)
219+
#> id1 id2 id3
220+
#> 2 1 0
221+
222+
# count secondary cases per subject from contact only
223+
epicontacts::get_degree(x = sample_net, type = "out", only_linelist = FALSE)
224+
#> id1 id2 id4 id3 id5
225+
#> 2 1 1 0 0
226+
```
227+
187228
:::::::::::::::::::::
188229

189230
From a histogram of the `all_secondary_cases` object, we can identify the **individual-level variation** in the number of secondary cases. Three cases were related to more than 20 secondary cases, while the complementary cases with less than five or zero secondary cases.

0 commit comments

Comments
 (0)