Monday, October 4, 2010

The extended family of CB Assumptions (Part 1)

Over the years, we have received lot of requests for adding new distributions to our distribution gallery. We have added new distributions in the recent past (like betaPERT), but not at the rate at which we get the requests. One of the primary reason for not implementing some of requests is that many of the requested distributions are special forms of distributions we already support (no, that is not the only reason, but it is often the reason). Here we will discuss some of the distributions which fall under this category, and are highly unlikely to be supported natively for this reason.

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
The above two tasks are, not surprisingly, ordered by the ascending order of difficulty. If you want to use a new distribution in your simulation model, you might want to do one of the above two tasks, and in some cases, both. So, let's get started with two easy examples in this post.

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
The same technique can be used to model the 2-parameter versions of gamma and Weibull distirbutions. The textbook notes of these distributions typically have the scale and shape parameter. CB implementation contain the location parameter for added flexibility, but one can model the two-parameter versions of these distributions easily as discussed above.

Part 2:  The extended family of CB Assumptions

No comments:

Post a Comment