Defines the parameters of a supported distribution for use in onward
modelling. Multiple distribution families are supported - see the
documentation for
family
for details. Alternatively, a nonparametric
distribution can be specified using the pmf
argument.
This function provides distribution
functionality in delay_opts()
, generation_time_opts()
, and
trunc_opts()
.
dist_spec(
mean,
sd = 0,
mean_sd = 0,
sd_sd = 0,
distribution = c("lognormal", "gamma"),
max,
pmf = numeric(0),
fixed = FALSE
)
A list of distribution options.
Numeric. If the only non-zero summary parameter
then this is the fixed interval of the distribution. If the sd
is
non-zero then this is the mean of the distribution given by dist
.
If this is not given a vector of empty vectors is returned.
Numeric, defaults to 0. Sets the standard deviation of the distribution.
Numeric, defaults to 0. Sets the standard deviation of the uncertainty around the mean of the distribution assuming a normal prior.
Numeric, defaults to 0. Sets the standard deviation of the uncertainty around the sd of the distribution assuming a normal prior.
Character, defaults to "lognormal". The (discretised distribution to be used. If sd == 0 then the distribution is fixed and a delta function is used. If sd > 0 then the distribution is discretised and truncated.
The following distributions are currently supported:
"lognormal" - a lognormal distribution. For this distribution mean
is the mean of the natural logarithm of the delay (on the log scale) and
sd
is the standard deviation of the natural logarithm of the delay.
"gamma" - a gamma distribution. For this distribution mean
is the
mean of the delay and sd
is the standard deviation of the delay. During
model fitting these are then transformed to the shape and scale of the gamma
distribution.
When distribution
is the default lognormal distribution the other function
arguments have the following definition:
mean
is the mean of the natural logarithm of the delay (on the
log scale).
sd
is the standard deviation of the natural logarithm of the delay.
Numeric, maximum value of the distribution. The distribution will be truncated at this value.
Numeric, a vector of values that represent the (nonparametric)
probability mass function of the delay (starting with 0); defaults to an
empty vector corresponding to a parametric specification of the distribution
(using mean
, sd
and corresponding uncertainties)
Logical, defaults to FALSE
. Should delays be treated
as coming from fixed (vs uncertain) distributions. Overrides any values
assigned to mean_sd
and sd_sd
by setting them to zero.
reduces compute requirement but may produce spuriously precise estimates.
Sebastian Funk
Sam Abbott
# A fixed lognormal distribution with mean 5 and sd 1.
dist_spec(mean = 5, sd = 1, max = 20, distribution = "lognormal")
# An uncertain gamma distribution with mean 3 and sd 2
dist_spec(
mean = 3, sd = 2, mean_sd = 0.5, sd_sd = 0.5, max = 20,
distribution = "gamma"
)
Run the code above in your browser using DataLab