Learn R Programming

EpiNow2 (version 1.3.4)

gamma_dist_def: Generate a Gamma Distribution Definition Based on Parameter Estimates

Description

[Soft-deprecated] Generates a distribution definition when only parameter estimates are available for gamma distributed parameters. See rgamma for distribution information.

Usage

gamma_dist_def(
  shape,
  shape_sd,
  scale,
  scale_sd,
  mean,
  mean_sd,
  sd,
  sd_sd,
  max_value,
  samples
)

Value

A data.table defining the distribution as used by dist_skel

Arguments

shape

Numeric, shape parameter of the gamma distribution.

shape_sd

Numeric, standard deviation of the shape parameter.

scale

Numeric, scale parameter of the gamma distribution.

scale_sd

Numeric, standard deviation of the scale parameter.

mean

Numeric, log mean parameter of the gamma distribution.

mean_sd

Numeric, standard deviation of the log mean parameter.

sd

Numeric, log sd parameter of the gamma distribution.

sd_sd

Numeric, standard deviation of the log sd parameter.

max_value

Numeric, the maximum value to allow. Defaults to 120. Samples outside of this range are resampled.

samples

Numeric, number of sample distributions to generate.

Author

Sam Abbott

Examples

Run this code
# using estimated shape and scale
def <- gamma_dist_def(
  shape = 5.807, shape_sd = 0.2,
  scale = 0.9, scale_sd = 0.05,
  max_value = 20, samples = 10
)
print(def)
def$params[[1]]

# using mean and sd
def <- gamma_dist_def(
  mean = 3, mean_sd = 0.5,
  sd = 3, sd_sd = 0.1,
  max_value = 20, samples = 10
)
print(def)
def$params[[1]]

Run the code above in your browser using DataLab