## How to incorporate shape, scale and location parameters using RAND("LOGNORMAL")

Solved
Occasional Contributor
Posts: 9

# How to incorporate shape, scale and location parameters using RAND("LOGNORMAL")

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!!!

Accepted Solutions
Solution
‎05-18-2016 08:40 AM
SAS Super FREQ
Posts: 3,843

## Re: How to incorporate shape, scale and location parameters using RAND("LOGNORMAL")

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."

All Replies
Occasional Contributor
Posts: 9

## Re: How to incorporate shape, scale and location parameters using RAND("LOGNORMAL")

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

Super User
Posts: 11,838

## Re: How to incorporate shape, scale and location parameters using RAND("LOGNORMAL")

Look at the PDF('LOGNORMAL') function

Occasional Contributor
Posts: 9

## Re: How to incorporate shape, scale and location parameters using RAND("LOGNORMAL")

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

Solution
‎05-18-2016 08:40 AM
SAS Super FREQ
Posts: 3,843

## Re: How to incorporate shape, scale and location parameters using RAND("LOGNORMAL")

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."

Occasional Contributor
Posts: 9

## Re: How to incorporate shape, scale and location parameters using RAND("LOGNORMAL")

Hi Rick,

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

Super User
Posts: 10,219

## Re: How to incorporate shape, scale and location parameters using RAND("LOGNORMAL")

Occasional Contributor
Posts: 9

## Re: How to incorporate shape, scale and location parameters using RAND("LOGNORMAL")

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

☑ This topic is solved.