Du er her: Forside Shared Statistics Lognormal simulated data generation and the SAS function RAND('LOGNORMAL')

Lognormal simulated data generation and the SAS function RAND('LOGNORMAL')

Af Paul Henning Krogh Sidst opdateret 18/01 2010 12:33

Just a helpful note: the RAND('LOGNORMAL') function returns random numbers from a
lognormal distribution, where the loge transformations of the produced random variates
has a mean (µ) of 0 and an STD (σ) of 1.

This means that the default lognormal distribution has a mean of 1.6487 and an STD of 2.1612
if µ=0 and σ=1 according to the formulae (SAS 2009, page 1038):

mean     = exp(µ + σ2/2)

variance= exp(2µ + 2σ2) - exp(2µ + σ2)

which can be verified by running the SAS code and estimate the mean and STD of the log-transformed lognormal_variate:

data lognorm;
do n=1 to 1000;
lognormal_variate=rand('lognormal');
normal_variate=log(lognormal_variate);
output;
end;
proc means mean STD maxdec=1;var normal_variate;
run;

Parameters μ and σ can be obtained if the values of mean and variance are known (from Wikipedia):

The mean and standard deviation of logtransformed lognormally distributed data

 

SAS Institute Inc., SAS® 9.2 Language Reference: Dictionary, Second Edition. SAS Institute Inc., Cary, NC, 2009.

Further reading: Engineering Statistics Handbook

Handlinger tilknyttet webside