norm2lnorm | R Documentation |
Converts mean and variance of normal distribution to the parameters for a log-normal distribution with the same mean and variance
norm2lnorm(m, v)
m |
Mean of the normal distribution |
v |
Variance of the normal distribution |
A vector of length two. The first element is the mean and the second element is the variance of the log-normal distribution
norm <- rnorm(1000, mean=5, sd=2)
params <- norm2lnorm(5, 2^2)
lnorm <- rlnorm(1000, meanlog=params[1], sdlog=params[2]^0.5)
# Mean and SD of lnorm is equivalent to mean and sd of norm
mean(lnorm)
sd(lnorm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.