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

posted by martin  – Austria, 2010-05-02 20:22 (5881 d 17:34 ago) – Posting: # 5272
Views: 68,423

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
23,653 posts in 4,991 threads, 1,570 registered users;
303 visitors (0 registered, 303 guests [including 20 identified bots]).
Forum time: 13:57 CEST (Europe/Vienna)

The epistemological value of probability theory is based on the fact
that chance phenomena, considered collectively and on a grand scale,
create non-random regularity.    Andrey Kolmogorov

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