epiverse-trace / serofoi

Estimates the Force-of-Infection of a given pathogen from population based sero-prevalence studies
https://epiverse-trace.github.io/serofoi/
Other
17 stars 4 forks source link

Fix data simulation functions sample size specification #140

Closed ntorresd closed 7 months ago

ntorresd commented 9 months ago

This PR corrects the data simulation functions get_sim_probability, get_sim_n_seropositive and generate_sim_data for them to build the simulated data based on the desired age structure of the survey and the desired sample sizes for each age group.

The use of generate_sim_data is exemplified by:

n_years <- 50
sim_data <- data.frame(
  age_mean_f = seq(1,n_years),
  tsur = 2050
)
foi <- rep(0.02, n_years)
sample_size_by_age <- as.integer(runif(n = n_years, 5, 10))
sim_data <- generate_sim_data(
  sim_data = sim_data,
  foi = foi,
  sample_size_by_age = sample_size_by_age,
  survey_label = "sim_constant_foi"
)

which generates a serosurvey with random sample sizes for each specified age group [1, ..., 50] (see image below).

image

codecov-commenter commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (5a0400c) 76.04% compared to head (9d4fbb7) 76.17%. Report is 4 commits behind head on main.

:exclamation: Current head 9d4fbb7 differs from pull request most recent head 8c6f862. Consider uploading reports for the commit 8c6f862 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #140 +/- ## ========================================== + Coverage 76.04% 76.17% +0.13% ========================================== Files 10 10 Lines 1603 1612 +9 ========================================== + Hits 1219 1228 +9 Misses 384 384 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.