lnormal_params: Calculate the Log-Normal Mean and Standard Deviation Using...

Description Usage Examples

View source: R/normal_lnormal_params.R

Description

Function to calculate the equivalent values for the mean and standard deviation of a normal distribution from the mean and standard deviation of the log-normal distribution and vice versa. Outputs from this function can be used with the dnorm() or dlnorm functions, and with the equivalent distributions in JAGS.

Usage

1
normal_params(log.mean, log.sd, coeff.variation = sqrt(exp(log.sd^2) - 1))

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
lmean <- 2.5
lsd <- 0.2
mean <- normal.params(lmean,lsd)[[1]]
sd <- normal.params(lmean,lsd)[[2]]

curve(dlnorm(x, lmean, lsd), from=0, to=25)
dev.new()
curve(dnorm(x, mean, sd), from=0, to=25)

mean <- 10
sd <- 2
lmean <- lnormal.params(mean,sd)[[1]]
lsd <- lnormal.params(mean,sd)[[2]]

curve(dnorm(x, mean, sd), from=0, to=20)
dev.new()
curve(dlnorm(x, lmean, lsd), from=0, to=20)

mdenwood/bayescount documentation built on Oct. 17, 2019, 6:59 a.m.