Before starting though, let's make sure we understand, what is meant by supporting a distribution in Crystal Ball. If we support a distribution, we will have to be able to do the following two things:
- Generate random numbers from this distribution
- Fit data to this distribution and generate Goodness-of-fit (GOF) statistics
Example 1: The Erlang distribution
This one is really straightforward. The Erlang distribution is a special case of the Gamma distribution where the shape parameter is an integer. Since we accept both integer and non-integer values for the shape parameter of our gamma distribution, simulating Erlang distribution with the gamma distribution is easy.
- Notes and formulas: Wikipedia entry linked above is sufficient.
- Generate random numbers: Define a gamma distribution assumption as usual. Just use the integer shape value.
- Fit to this distribution: Fitting to an Erlang distribution is slightly tricky. We will come back to this later in a future post in this series.
Example 2: The two parameter lognormal distribution
Some time back, we introduced the 3-parameter lognormal distribution, the extra parameter being location. The 3-parameter lognormal distribution is somewhat unusual, since it is not covered in any textbook and the use of the distribution in this form is not well documented. Our main reason for introducing it was to offer more flexibility in the distribution (like having values < 0). Nevertheless, although we had made sure at that time that this new distribution is completely backward-compatible with the classic two-parameter distribution (all models having the two parameter distribution will run the same way without any change), I am sure this change might have taken a few souls by surprise (yes, that might be putting it mildly in some cases). So, let's go back in time and simulate the classic 2-parameter lognormal in the current version of Crystal Ball.
- Notes and formulas: Wikipedia entry will serve us good here.
- Generate random numbers: That's easy - define a 3-parameter lognormal distribution with the location set to 0.
- Fit to this distribution: This is also easy with a few new features which were also introduced in the same version of Crystal Ball. When you get to the 'Fit Distribution' dialog from the 'Distribution Gallery', switch on 'Lock parameters', available at the bottom left of the screen.That would bring up the 'Lock Parameters' dialog. Select to lock the location of the lognormal distribution to 0, as shown in the screenshot below. This would result in fitting to the classic lognormal distribution, and you would get all the GOF statistics for the fit.
|Fitting data to a 2-parameter lognormal distribution|
Part 2: The extended family of CB Assumptions