LogNormal Distribution Parameters Question

38 views
Skip to first unread message

Christina Seo

unread,
Jan 10, 2025, 3:35:19 PM1/10/25
to JaamSim Users Discussion Group
Hi,

I'm building a DES model of an emergency room and I'm in the middle of modelling different processes and their service times. I've fit my distributions through python and have come up with appropriate parameters, however when I translate these parameters to JaamSim, I'm getting an unexpected error: 

Could not find a sample value that was within the range specified by the MinValue and MaxValue inputs. Number of samples tested = 1000 


The distribution I fit in Python was lognorm Parameters: (s=0.5115721843941159, loc=-4.48772317308287, scale=21.79052118482253) 


I translated this to JaamSim as:

Location: -4.488 minutes Scale: 21.791 minutes NormalMean: 3.082 (dimensionless) NormalSD: 0.512 (dimensionless) Min: 0 minutes Max: 60 minutes

And I chose the min and max based on my original data and the visual distribution. 

Then, I tested these parameters in Python to see how often samples would appear out of bounds, and the proportion of samples within bounds was 99.1%

# Parameters
shape = 0.512 # NormalStandardDeviation
scale = 21.791 # Scale
loc = -4.488 # Location
min_value, max_value = 0, 60 # Bounds

# Generate samples
samples = lognorm.rvs(shape, loc=loc, scale=scale, size=1000)
valid_samples = [s for s in samples if min_value <= s <= max_value]

# Check the proportion of valid samples
valid_ratio = len(valid_samples) / len(samples)
print(f"Proportion of samples within bounds: {valid_ratio:.2%}")


Thus, I'm a bit confused why this error is appearing in JaamSim. Am I misinterpreting one of the input parameters?

Any help would be appreciated!

Thanks,

Christina

Harry King

unread,
Jan 10, 2025, 8:19:09 PM1/10/25
to JaamSim Users Discussion Group
Hi Christina,

The revised User Manual for JaamSim has a much better description of the lognormal distribution, but it has not been released yet. The relevant material is as follows:

The LogNormalDistribution generates random samples from a Log-Normal probability distribution.  If z is a normally-distributed random variable, then x = exp(z) is log-normally distributed.

Parameters

Location, Scale, NormalMean, NormalStandardDeviation

The NormalMean and NormalStandardDeviation parameters are the mean and standard deviation for the underlying normal distribution.

The Scale input for the Log-Normal distribution should be set to 1.0 in the units to be returned by the distribution.  For example, if samples with the units of time in hours are to be generated, then the Scale input should be set to 1.0 h.  The effective scale parameter for the Log-Normal distribution is the product of the Scale input and the exponential of the NormalMean input.

Probability Density Function

PDF(x) = 1/(y * Shape * sqrt(2*Pi)) * exp((-(ln(y))^2)/(2*Shape^2))

         where y = (x - Location) / EffScale,

               EffScale = Scale * exp(NormalMean), and

               Shape = NormalStandardDeviation

Cumulative Distribution Function

CDF(x) = no closed form solution

Mean Value
mean = Location + Scale * exp(NormalMean) * exp(NormalStandardDeviation^2 / 2) 

For your lognormal distribution, the JaamSim parameters should be:

Location:    -4.48772317308287 min
Scale:   1.0 min
NormalMean:  ln(21.79052118482253) = 3.081475
NormalStandardDeviation:   0.5115721843941159

Harry

Christina Seo

unread,
Jan 13, 2025, 3:42:48 PM1/13/25
to JaamSim Users Discussion Group
Hi Harry,

Thanks for the help! Really appreciate the clear and prompt response.

Thanks,
Christina

Reply all
Reply to author
Forward
0 new messages