Skip to contents

Create a list of configuration settings for some details of sim_linelist()

Usage

create_config(...)

Arguments

...

<dynamic-dots> Named elements to replace default settings. Only if names match exactly are elements replaced, otherwise the function errors.

Value

A list of settings for sim_linelist()

Details

The config argument in sim_linelist() controls the small details around time windows around infections (time of first contact and last contact with infector), and the distribution of the Cycle threshold (Ct) value from a Real-time PCR or quantitative PCR (qPCR) for confirmed cases, the network effect in the simulation, and if there is a time-varying death risk.

Accepted arguments and their defaults are:

  • last_contact_distribution = "pois"

  • last_contact_distribution_params = c(lambda = 3)

  • first_contact_distribution = "pois"

  • first_contact_distribution_params = c(lambda = 3)

  • ct_distribution = "norm"

  • ct_distribution_params = c(mean = 25, sd = 2)

  • network = "adjusted"

  • time_varying_death_risk = NULL

These parameters do not warrant their own arguments in sim_linelist() as they rarely need to be changed from their default setting. Therefore it is not worth increasing the number of sim_linelist() arguments to accommodate these and the config argument keeps the function signature simpler and more readable.

The accepted distributions are:

  • last_contact_distribution = c("pois", "geom")

  • first_contact_distribution = c("pois", "geom")

  • ct_distribution = c("norm", "lnorm")

The network option controls whether to sample contacts from a adjusted or unadjusted contact distribution. Adjusted (default) sampling uses \(q(n) \sim (n + 1)p(n + 1)\) where \(p(n)\) is the probability density function of a distribution, e.g., Poisson or Negative binomial. Unadjusted (network = "unadjusted") instead samples contacts directly from a probability distribution \(p(n)\).

Examples

# example with default configuration
create_config()
#> $last_contact_distribution
#> [1] "pois"
#> 
#> $last_contact_distribution_params
#> lambda 
#>      3 
#> 
#> $first_contact_distribution
#> [1] "pois"
#> 
#> $first_contact_distribution_params
#> lambda 
#>      3 
#> 
#> $ct_distribution
#> [1] "norm"
#> 
#> $ct_distribution_params
#> mean   sd 
#>   25    2 
#> 
#> $network
#> [1] "adjusted"
#> 
#> $time_varying_death_risk
#> NULL
#> 

# example with customised Ct distribution
create_config(
  ct_distribution = "lnorm",
  ct_distribution_params = c(meanlog = 2, sdlog = 1)
)
#> $last_contact_distribution
#> [1] "pois"
#> 
#> $last_contact_distribution_params
#> lambda 
#>      3 
#> 
#> $first_contact_distribution
#> [1] "pois"
#> 
#> $first_contact_distribution_params
#> lambda 
#>      3 
#> 
#> $ct_distribution
#> [1] "lnorm"
#> 
#> $ct_distribution_params
#> meanlog   sdlog 
#>       2       1 
#> 
#> $network
#> [1] "adjusted"
#> 
#> $time_varying_death_risk
#> NULL
#>