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

posted by martin  – Austria, 2010-05-02 20:22 (5105 d 08:27 ago) – Posting: # 5272
Views: 56,232

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,993 posts in 4,828 threads, 1,657 registered users;
58 visitors (0 registered, 58 guests [including 9 identified bots]).
Forum time: 04:50 CEST (Europe/Vienna)

So far as I can remember,
there is not one word in the Gospels
in praise of intelligence.    Bertrand Russell

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