Closed Bisaloo closed 10 months ago
This PR closes #57 .
Merging #126 (bf211b8) into main (fe428e5) will increase coverage by
0.70%
. The diff coverage is79.74%
.:exclamation: Current head bf211b8 differs from pull request most recent head f5b5be6. Consider uploading reports for the commit f5b5be6 to get more accurate results
@@ Coverage Diff @@
## main #126 +/- ##
==========================================
+ Coverage 76.06% 76.77% +0.70%
==========================================
Files 10 10
Lines 1496 1563 +67
==========================================
+ Hits 1138 1200 +62
- Misses 358 363 +5
Files | Coverage Δ | |
---|---|---|
R/seroprevalence_data.R | 77.19% <100.00%> (+27.19%) |
:arrow_up: |
R/visualisation.R | 0.00% <0.00%> (ø) |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
Hi @ben18785,
Continuing the conversation we had in #83, I implemented tests for different values of constant FoI using a large value for the sample size per age group and checked that the seroprevalence obtained for each is in accordance with the analytical solution of the serocatalytic model. I did the same for a stepwise decreasing time-varying FoI. In general, for a model without sero-reversion we have: $$\frac{dP(t)}{dt} = \lambda(t) (1 - P(t))$$ yielding the solution[ref] $$P(t) = 1 - \exp\left(-\int_0^{t'} \lambda(t')dt' \right),$$ Changing from time to ages, the implementation for the stepwise decreasing FoI looks like:
seed <- 1234
sample_size_by_age <- 10^7
tsur <- 2050
birth_year_min <- 2000
no_transm <- 0.0000000001
foi_sim <- c(rep(0.2, 25), rep(0.1, 10), rep(no_transm, 15))
sim_data <- generate_sim_data(foi = foi_sim,
sample_size_by_age = sample_size_by_age,
tsur = tsur,
birth_year_min = birth_year_min,
survey_label = 'sw_dec_foi',
seed = seed)
prev_exact <- 1 - exp(-cumsum(rev(foi_sim)))
expect_equal(sim_data$prev_obs, prev_exact, tolerance = TRUE)
It should be easy to test for other time-varying FoI in the limiting case.
Reopening #83 after repository clean-up.