DistGamma
- class pydsol.core.distributions.DistGamma(stream: StreamInterface, shape: float, scale: float)[source]
Bases:
DistContinuous
The Gamma distribution is a continuous distribution that yields positive numbers. The gamma distribution represents the time to complete some task, e.g. customer service or machine repair. The parameters are not rate-related, but average-related, so the mean is (shape * scale) and the variance is (shape * scale ** 2).
- __init__(stream: StreamInterface, shape: float, scale: float)[source]
Constructs a new Gamma distribution, with two parameters: shape and scale. The Gamma distribution is a continuous distribution and will return a positive number. The Gamma distribution represents the time to complete some task, e.g. customer service or machine repair. The parameters are not rate-related, but average-related, so the mean is (shape * scale) and the variance is (shape * scale ** 2).
- Parameters:
stream (StreamInterface) – the random stream to use for this distribution
shape (float or int) – the shape parameter, also called alpha or k
scale (float or int) – the scale parameter, also called beta or theta
- Raises:
TypeError – when stream is not implementing StreamInterface:
TypeError – when shape or scale is not a float or int:
ValueError – when shape <= 0 or scale <= 0:
- draw() float [source]
Draw a value from the Gamma distribution. Based on the algorithm in Law & Kelton, Simulation Modeling and Analysis, 1991, pages 488-489.
- property shape: float
Return the parameter value shape, also called alpha or k
- property scale: float
Return the parameter value scale, also called beta or theta
- property stream: StreamInterface
Return the current random stream for this distribution.