BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jonesk48
Fluorite | Level 6

Hello All,

 

I am starting to do more simulations and have a general question regarding simulating a lognormal distribution.  I have existing data that looks like the following (I've fitted a lognormal curve to the data). I would like to simulate more data using the MLE estimated shape, scale and location parameters for the exisiting data.  I noticed the RAND function does not support location, shape or scale for the lognormal distribution. How can I incorporate these parameters so that I can simulate data to look like my original data? I thought I could do Y = location parameter + scale parameter*X, where X =RAND("LOGNORMAL"). Am I on the right track here? Any help appreciated!!!

 

Histogram56.png

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Chapter 7 of Wicklin (2013) Simulating Data with SAS has a section on "Adding Location and Scale Parameters" (p. 107-109).

For the lognormal function it says:

 

The RAND("Normal", mu, sigma) function generates X ~ N(mu, sigma). The random variable Y = exp(X) is

lognormally distributed with parameters  mu and sigma..... Notice that the location and scale parameters are added before the

exponential transformation is applied.

 

You can add a threshold parameter by generating theta+Y.

 

For an example in teh DATA step, see "Simulate lognormal data with specified mean and variance."

 

View solution in original post

7 REPLIES 7
jonesk48
Fluorite | Level 6

Just for clarity, the embedded picture is from my acutal data. I would like to simulate more data that looks like this.

 

 

jonesk48
Fluorite | Level 6

Yes I will, thank you! I didn't think about using the pdf function.

Rick_SAS
SAS Super FREQ

Chapter 7 of Wicklin (2013) Simulating Data with SAS has a section on "Adding Location and Scale Parameters" (p. 107-109).

For the lognormal function it says:

 

The RAND("Normal", mu, sigma) function generates X ~ N(mu, sigma). The random variable Y = exp(X) is

lognormally distributed with parameters  mu and sigma..... Notice that the location and scale parameters are added before the

exponential transformation is applied.

 

You can add a threshold parameter by generating theta+Y.

 

For an example in teh DATA step, see "Simulate lognormal data with specified mean and variance."

 

jonesk48
Fluorite | Level 6

Hi Rick,

 

Thank you for the feedback!  I understand now, and the link you provided with the example helps greatly.

 

jonesk48
Fluorite | Level 6

Thank you! This link is very helpful, Rick also referred to the same content on his blog. I appreciate your feedback!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 1796 views
  • 3 likes
  • 4 in conversation