---
title: "Generating your own distributions"
canonical: "https://modelassist.epixanalytics.com/space/EA/26575295/Generating%20your%20own%20distributions"
format: markdown
---
Crystal Ball offers a wide variety of distributions, but there are an enormous number available, and we may want to make use of one that Crystal Ball does not offer. The section on [creating distributions](https://epixanalytics.atlassian.net/wiki/spaces/EA/pages/26575271/) illustrates the four methods we use at Epix Analytics to generate your own distribution.

  


One way we can generate our own distribution is if one can determine an equation for *x = G(F(x))*.

The process for generating values from one's own distribution is as follows:

1.     determine the probability density function *f(x)*;  
2.     determine the distribution function *F(x)* from *f(x)* or determine *F(x)* directly;  
3.     determine the generating function *G(F(x))* from *F(x)*.

#### Example:

Let's say you wish to construct a distribution that followed the shape of a sine curve from 0 to a, where a is an input to the distribution. This distribution shape is shown below:

  


![image](media://3e3c03bc-a946-425d-8d8e-9518a2e02700)

  


The probability density function *f(x)* is given by:

![image](media://7d020b1e-93e7-4a80-b012-13c1cc1acd73)

  


> Macro (mathblock)

where *b* is to be determined such that the area under the curve equals one.

The distribution function *F(x)* is then:

![image](media://b5948b22-5352-4dd1-bd73-c1f14aa18a01)

  


  


> Macro (mathblock)

![image](media://575e3c96-5e38-4e99-a88a-18e97531273d)

  


> Macro (mathblock)

  


For the area under the curve to equal one, *b* must be determined such that *F(a)* = 1, i.e.:

![image](media://61f7706a-efb1-4087-a3ec-74a30c6babee)

  


> Macro (mathblock)

Therefore,

![image](media://3803f131-ee37-4ae6-9d3a-d21647c2adde)

  


> Macro (mathblock)

and *F(x)* becomes:

![image](media://b10b61a2-6fed-49f0-8b0e-3197fbccfdfd)

  


> Macro (mathblock)

We now need to find the generating function *G(F(x))*:

  


                *G(F(x))* = *x*

  


So, rearranging the equation above for *x*:

![image](media://3abd3fa1-5a08-43d8-b75b-40cf8329740b)

  


> Macro (mathblock)

Now, to generate this distribution, we put a Uniform(0,1) distribution in cell A1 (say), the value for *a* in cell B1 (say) and, in the cell that generates values of *x*, we write:

                = B1/PI() * ACOS (1-2*A1)

If we use [Latin Hypercube Sampling](https://epixanalytics.atlassian.net/wiki/spaces/EA/pages/26575293/) to generate the values from the Uniform(0,1) distribution, we will generate a smoothly distributed set of *x*-values that will replicate the desired distribution.

  


  


  


---