log-normal: Log-normal distribution parameters

lnorm_meanR Documentation

Log-normal distribution parameters

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

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 a named numeric vector with elements named meanlog describing means and elements named sdlog describing standard deviations.

Examples

# 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])

tzoltak/rstyles documentation built on Dec. 4, 2024, 5:16 p.m.