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

posted by martin  – Austria, 2010-05-02 20:22 (5526 d 13:24 ago) – Posting: # 5272
Views: 62,866

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,424 posts in 4,927 threads, 1,675 registered users;
21 visitors (0 registered, 21 guests [including 5 identified bots]).
Forum time: 09:47 CEST (Europe/Vienna)

Philosophy, like medicine, has plenty of drugs, few good remedies,
and hardly any specific cures.    Sebastien-Roch Nicolas de Chamfort

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