Get a Parameters that Define a Discrete Distribution

get_dist_def(
  values,
  verbose = FALSE,
  samples = 1,
  bootstraps = 1,
  bootstrap_samples = 250
)

Arguments

values

Numeric vector of integer values.

verbose

Logical, defaults to FALSE. Should progress messages be printed

samples

Numeric, number of samples to take overall from the bootstrapped posteriors.

bootstraps

Numeric, defaults to 1. The number of bootstrap samples (with replacement) of the delay distribution to take.

bootstrap_samples

Numeric, defaults to 100. The number of samples to take in each boostrap. When the sample size of the supplied delay distribution is less than 100 this is used instead.

Value

A data.table of distributions and the parameters that define them.

Author

Sebastian Funk sebastian.funk@lshtm.ac.uk

Examples

## Example with exponential and a small smaple delays <- rexp(20, 1) get_dist_def(delays, samples = 10, verbose = TRUE)
#> Exponential selected as the best fit for the distribution
#> model max_value params #> 1: exp 4 <list[1]> #> 2: exp 4 <list[1]> #> 3: exp 4 <list[1]> #> 4: exp 4 <list[1]> #> 5: exp 4 <list[1]> #> 6: exp 4 <list[1]> #> 7: exp 4 <list[1]> #> 8: exp 4 <list[1]> #> 9: exp 4 <list[1]> #> 10: exp 4 <list[1]>
if (FALSE) { ## Example with gamma and a larger sample delays <- rgamma(50, 4, 1) out <- get_dist_def(delays, samples = 2, bootstraps = 2) ## Inspect out ## Inspect one parameter out$params[[1]] ## Load into skeleton and sample with truncation EpiNow::dist_skel(10, model = out$model[[1]], params = out$params[[1]], max_value = out$max_value[[1]]) }