parametrization of R function rlnorm [🇷 for BE/BA]

posted by martin  – Austria, 2010-05-02 20:22 (5100 d 12:41 ago) – Posting: # 5272
Views: 56,222

dear d_labes!

I just want to draw your attention to the parametrization of R function rlnorm. When you want to generate log-normal distributed random variables with a given mean and CV on the observed scale - I suggest to use meanlog=log(mean)-0.5*log(1+cv^2) instead of meanlog=log(mean).

# example
set.seed(020510)
n <- 1E6
mue <- 5
cv <- 0.5

x <- rlnorm(n=n, meanlog=log(mue)-0.5*log(1+cv^2), sdlog=sqrt(log(1+cv^2)))
y <- rlnorm(n=n, meanlog=log(mue), sdlog=sqrt(log(1+cv^2)))

mean(x); sd(x)/mean(x)
mean(y); sd(y)/mean(y)


best regards

martin

Complete thread:

UA Flag
Activity
 Admin contact
22,987 posts in 4,824 threads, 1,663 registered users;
85 visitors (0 registered, 85 guests [including 5 identified bots]).
Forum time: 09:04 CEST (Europe/Vienna)

The only way to comprehend what mathematicians mean by Infinity
is to contemplate the extent of human stupidity.    Voltaire

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5