lnHyperPars: Convert mean and standard deviation into log-normal...

View source: R/bayes_functions.R

lnHyperParsR Documentation

Convert mean and standard deviation into log-normal distribution parameters

Description

lnHyperPars is a function for calculating parameters for a log-normal distribution, such that the distribution yields desired mean and standard deviation. Used for sampling the a-parameter.

Usage

lnHyperPars(mean, sd)

Arguments

mean

the desired mean.

sd

the desired standard deviation.

Value

lnHyperPars returns two values. These can be directly supplied to rlnorm.

Examples

pars <- lnHyperPars(2, 4)
x <- rlnorm(1000000, pars[1], pars[2])
mean(x) # close to 2
sd(x)   # close to 4


TestDesign documentation built on Feb. 16, 2023, 7:19 p.m.