Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrapper for literature/known incubation periods for other infections #7

Open
smwindecker opened this issue Dec 13, 2023 · 2 comments
Open

Comments

@smwindecker
Copy link
Contributor

Currently incubation period distributions are created by make_cdf. We want to allow for other diseases with other strains/covariants.

@smwindecker
Copy link
Contributor Author

smwindecker commented Dec 20, 2023

make_cdf / make_ecdf duplication. make_cdf should be split to a few levels of function.

base function to make distributions from empirical data
hard code distribution
from parameters for given dist.
these can all be called for ones which are prebaked from other functions.
combine two pmfs

@smwindecker smwindecker changed the title incubation periods for other infections modify cdf structures incubation periods for other infections Dec 20, 2023
@smwindecker smwindecker changed the title modify cdf structures incubation periods for other infections wrapper for literature/known incubation periods for other infections Feb 19, 2024
@smwindecker
Copy link
Contributor Author

old make_cdf which we can reference for th different variant wrappers:

#' Make cumulative density function
#'
#' @description Define cumulative density function. Used especially for
#'  calculation of incubation period. Parameters for Omicron and Delta
#'  SARS-CoV-2 strains estimated from
#'  https://www.eurosurveillance.org/content/10.2807/1560-7917.ES.2022.27.6.2200042.
#'  This is not a time-varying biological quantity - any changes in the
#'  dominant variant should be modelled separately.
#'
#' @param option SARS-CoV-2 covariant or NULL model
#'
#' @importFrom stats approxfun pweibull
#'
#' @return cumulative density function for incubation period
#' @export
make_cdf <- function (option = c('Omicron',
                                 'Delta',
                                 'None'),
                      weibull_shape = NULL,
                      weibull_scale = NULL) {

  days <- 0:28

  f <- function (option) {
    switch (option,
            Delta = stats::pweibull(days, shape = 1.83, scale = 4.93),
            Omicron = stats::pweibull(days, shape = 1.5, scale = 3.6),
            None = stats::pweibull(days,
                                   shape = weibull_shape,
                                   scale = weibull_scale))
  }


  cum_density <- f(option)
  cdf <- stats::approxfun(days, cum_density)

  return(cdf)
}

@smwindecker smwindecker transferred this issue from idem-lab/epiwave Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant