Closed joshwlambert closed 2 weeks ago
Reproducing the reprex above using the updates made in PR #142.
library(simulist)
library(epiparameter)
# load data required to simulate line list
contact_distribution <- epiparameter::epidist(
disease = "Ebola",
epi_dist = "contact distribution",
prob_distribution = "pois",
prob_distribution_params = c(mean = 2)
)
#> Citation cannot be created as author, year, journal or title is missing
infect_period <- epiparameter::epidist(
disease = "Ebola",
epi_dist = "infectious period",
prob_distribution = "norm",
prob_distribution_params = c(mean = 9.4, sd = 5.5)
)
#> Citation cannot be created as author, year, journal or title is missing
onset_to_hosp <- epidist(
disease = "ebola",
epi_dist = "onset to hospitalisation",
prob_distribution = "gamma",
prob_distribution_params = c(shape = 1.6, scale = 3.0)
)
#> Citation cannot be created as author, year, journal or title is missing
onset_to_death <- epidist_db(
disease = "ebola",
epi_dist = "onset to death",
single_epidist = TRUE
)
#> Using WHO Ebola Response Team, Agua-Agum J, Ariyarajah A, Aylward B, Blake I,
#> Brennan R, Cori A, Donnelly C, Dorigatti I, Dye C, Eckmanns T, Ferguson
#> N, Formenty P, Fraser C, Garcia E, Garske T, Hinsley W, Holmes D,
#> Hugonnet S, Iyengar S, Jombart T, Krishnan R, Meijers S, Mills H,
#> Mohamed Y, Nedjati-Gilani G, Newton E, Nouvellet P, Pelletier L,
#> Perkins D, Riley S, Sagrado M, Schnitzler J, Schumacher D, Shah A, Van
#> Kerkhove M, Varsaneux O, Kannangarage N (2015). "West African Ebola
#> Epidemic after One Year — Slowing but Not Yet under Control." _The New
#> England Journal of Medicine_. doi:10.1056/NEJMc1414992
#> <https://doi.org/10.1056/NEJMc1414992>..
#> To retrieve the citation use the 'get_citation' function
onset_to_recovery <- epidist(
disease = "ebola",
epi_dist = "onset to recovery",
prob_distribution = "gamma",
prob_distribution_params = c(shape = 19.8, scale = 0.9)
)
#> Citation cannot be created as author, year, journal or title is missing
set.seed(1234)
linelist <- sim_linelist(
contact_distribution = contact_distribution,
infect_period = infect_period,
onset_to_hosp = onset_to_hosp,
onset_to_death = onset_to_death,
onset_to_recovery = onset_to_recovery,
prob_infect = 0.6,
outbreak_size = c(500, 2000),
non_hosp_death_risk = 0.4
)
#> Error: Negative infectious period sampled. The infectious period must be strictly positive.
Created on 2024-06-17 with reprex v2.1.0
There an issue when simulating a line list with
sim_linelist()
when the distribution of the infectious period can generate negative values, reported by @CarmenTamayo.Negative infectious periods do not make epidemiological sense (in the model the time an infector makes contact with their sampled contacts is uniformally distributed within the infectious period).
The
sim_linelist()
function runs and creates a line list<data.frame>
as well as several warnings generated bystats::runif()
from within.sim_network_bp()
when theinfect_period
produces negative values. The columns of the line list get populated withNaN
s. Here is an example:Created on 2024-06-17 with reprex v2.1.0