Generate a Log Normal Distribution Definition Based on Parameter Estimates
Source:R/dist.R
lognorm_dist_def.Rd
Generates a distribution definition when only parameter estimates
are available for log normal distributed parameters. See rlnorm
for
distribution information.
Arguments
- 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.
- to_log
Logical, should parameters be logged before use.
Examples
def <- lognorm_dist_def(
mean = 1.621, mean_sd = 0.0640,
sd = 0.418, sd_sd = 0.0691,
max_value = 20, samples = 10
)
print(def)
#> model params max_value
#> 1: lognormal <list[2]> 20
#> 2: lognormal <list[2]> 20
#> 3: lognormal <list[2]> 20
#> 4: lognormal <list[2]> 20
#> 5: lognormal <list[2]> 20
#> 6: lognormal <list[2]> 20
#> 7: lognormal <list[2]> 20
#> 8: lognormal <list[2]> 20
#> 9: lognormal <list[2]> 20
#> 10: lognormal <list[2]> 20
def$params[[1]]
#> $mean
#> [1] 1.693223
#>
#> $sd
#> [1] 0.319885
#>
def <- lognorm_dist_def(
mean = 5, mean_sd = 1,
sd = 3, sd_sd = 1,
max_value = 20, samples = 10,
to_log = TRUE
)
print(def)
#> model params max_value
#> 1: lognormal <list[2]> 20
#> 2: lognormal <list[2]> 20
#> 3: lognormal <list[2]> 20
#> 4: lognormal <list[2]> 20
#> 5: lognormal <list[2]> 20
#> 6: lognormal <list[2]> 20
#> 7: lognormal <list[2]> 20
#> 8: lognormal <list[2]> 20
#> 9: lognormal <list[2]> 20
#> 10: lognormal <list[2]> 20
def$params[[1]]
#> $mean
#> [1] 1.475956
#>
#> $sd
#> [1] 0.6237088
#>