Distributions are specified with distspec, whose constructors Normal(), Gamma(), LogNormal(), Exponential(), Weibull(), Beta(), Fixed() and NonParametric() composableIDModelR re-exports. Parameters can be given naturally (Gamma(shape = 2, rate = 0.5)) or as a mean and standard deviation (Gamma(mean = 4, sd = 2)).

HalfNormal(mean = 1)

truncated(dist, lower = -Inf, upper = Inf)

Arguments

mean

Numeric. Mean of the half-normal distribution.

dist

A distribution to truncate.

lower, upper

Numeric truncation bounds. Use -Inf or Inf to leave a side unbounded.

Value

A component of class julia_distribution.

Details

composableIDModelR adds two constructors of its own:

  • HalfNormal(), the prior from ComposableTuringIDModels.jl, parameterised by its mean.

  • truncated(), which bounds a distribution below as well as above. The max argument of a distspec distribution bounds it above only.

Where a distribution is used decides what it may contain. A prior, such as the damping of an AR() process, needs fixed parameters. A delay or generation time may have uncertain parameters (for example LogNormal(meanlog = Normal(1.6, 0.2), sdlog = 0.4, max = 15)), and is then inferred along with the rest of the model; such a distribution needs a finite max to bound its support.

Examples

# A prior bounded to [0, 1]
truncated(Normal(0.8, 0.05), 0, 1)
#> <julia distribution spec>
#> truncated(Normal(0.8, 0.05), 0.0, 1.0)

# A generation time, discretised in Julia
Gamma(shape = 6.5, scale = 0.62)
#> - gamma distribution:
#>   shape:
#>     6.5
#>   rate:
#>     1.6

# A delay whose parameters are inferred
LogNormal(meanlog = Normal(1.6, 0.2), sdlog = 0.4, max = 15)
#> - lognormal distribution
#> Returning NA: this distribution has uncertain parameters.
#> ℹ Resolve the uncertainty first with `fix_parameters()`.
#> This message is displayed once every 8 hours.
#>  (max: 15):
#>   meanlog:
#>     - normal distribution:
#>       mean:
#>         1.6
#>       sd:
#>         0.2
#>   sdlog:
#>     0.4