log-normal: Log-normal distribution parameters

Description Usage Arguments Value Examples

Description

Functions return parameters of a log-normal distribution on the exponentiated scale (lnorm_mean, lnorm_sd) or values of parameters on the log scale that will result in given values of parameters on the exponentiated scale (find_pars_lnorm).

Usage

1
2
3
4
5
lnorm_mean(meanlog, sdlog)

lnorm_sd(meanlog, sdlog)

find_pars_lnorm(m, sd)

Arguments

meanlog

mean (expected value)of the distribution on the log scale

sdlog

standard deviation of the distribution on the log scale

m

mean (expected value) of the distribution on the exponential scale

sd

standard deviation of the distribution on the exponential scale

Value

lnorm_mean() and lnorm_sd() return numeric vectors; find_pars_lnorm() returns named numeric vector with elements named meanlog describing means and elements named sdlog describing standard deviations.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# actual expected value of the log-normal distribution with the log scale
# parameters of 3 and 1.5 respectively
lnorm_mean(3, 1.5)
# check:
mean(rlnorm(10^6, 3, 1.5))
# actual standard deviation of the log-normal distribution with the log scale
# parameters of 3 and 1.5 respectively
lnorm_sd(3, 1.5)
# check:
sd(rlnorm(10^6, 3, 1.5))
# what log scale parameters one should use to get actual (exponentiated scale)
# expected value and standard deviaton of the geneareted data of 1 and 0.2
# respectively?
(p <- find_pars_lnorm(1, 0.2))
# check:
lnorm_mean(p[1], p[2])
lnorm_sd(p[1], p[2])

rstyles documentation built on July 23, 2021, 5:07 p.m.