epiverse-trace / epiverse-trace/simulist

add a default reporting delay

Open
#295 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
11
Forks
1
Avg merge
3d 1h
Merged PRs (30d)
2

Description

Could adding a reporting delay distribution by default make the output more realistic?

If it does, it would help us add a challenge to calculate the reporting delay at the end of the aggregate/visualize tutorial episode in `tutorials-early` (as a way to reinforce the arithmetic calculation of delays before `tutorials-middle`)

``` r
set.seed(1)

sim_data <- simulist::sim_linelist(
outbreak_size = c(1000, 1500),
reporting_delay = function(n) stats::rlnorm(n = n, meanlog = 2, sdlog = 0.5)
) |>
dplyr::as_tibble()
#> Warning: Number of cases exceeds maximum outbreak size.
#> Returning data early with 1546 cases and 3059 total contacts (including cases).

sim_data |>
dplyr::select(id, date_reporting, date_onset) |>
dplyr::mutate(reporting_delay = date_reporting - date_onset) |>
dplyr::filter(reporting_delay >= 0)
#> # A tibble: 1,546 × 4
#> id date_reporting date_onset reporting_delay
#>
#> 1 1 2023-01-16 2023-01-01 15.268826 days
#> 2 3 2023-01-21 2023-01-11 9.885624 days
#> 3 6 2023-02-04 2023-01-18 17.038472 days
#> 4 8 2023-01-28 2023-01-23 5.295363 days
#> 5 11 2023-02-03 2023-01-30 4.411229 days
#> 6 14 2023-01-29 2023-01-24 4.781225 days
#> 7 15 2023-02-05 2023-01-31 5.148057 days
#> 8 16 2023-02-03 2023-01-30 3.270287 days
#> 9 20 2023-02-01 2023-01-27 5.174639 days
#> 10 21 2023-02-21 2023-02-09 12.353342 days
#> # ℹ 1,536 more rows

sim_data |>
dplyr::select(id, date_reporting, date_onset) |>
cleanepi::timespan(
target_column = "date_onset",
end_date = "date_reporting",
span_unit = "days",
span_column_name = "reporting_delay"
) |>
dplyr::filter(reporting_delay >= 0)
#> # A tibble: 1,546 × 4
#> id date_reporting date_onset reporting_delay
#>
#> 1 1 2023-01-16 2023-01-01 15.3
#> 2 3 2023-01-21 2023-01-11 9.89
#> 3 6 2023-02-04 2023-01-18 17.0
#> 4 8 2023-01-28 2023-01-23 5.30
#> 5 11 2023-02-03 2023-01-30 4.41
#> 6 14 2023-01-29 2023-01-24 4.78
#> 7 15 2023-02-05 2023-01-31 5.15
#> 8 16 2023-02-03 2023-01-30 3.27
#> 9 20 2023-02-01 2023-01-27 5.17
#> 10 21 2023-02-21 2023-02-09 12.4
#> # ℹ 1,536 more rows
```

Created on 2026-06-17 with [reprex v2.1.1](https://reprex.tidyverse.org)

Contributor guide

Open the contributing guide

Research direction

Start at the sim_linelist() entry point and inspect how reporting_delay is handled when it is omitted. Then read the aggregate/visualize episode in tutorials-early to understand where the reporting-delay calculation challenge belongs. Done means a default delay distribution produces realistic reporting dates and the tutorial reinforces calculating that delay before tutorials-middle.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.