|Normal Distribution Method|
Normal Distribution Results
Normal Distribution Method
The normal distribution, also called Gaussian distribution, is a probability distribution of great importance in many
The histogram data is constructed by segmenting the range of the data into equal-sized bins. The vertical axis of the
histogram is the number of counts for each bin, and the horizontal axis of the histogram is labeled with the range of
response variable. Of course, the best approach to examine the normal distribution is to display the results graphically on a
chart. The user can plot results through charting programs, such as Microsoft Excel and Matlab.
Normal Random Number Generator
A normal random generation can be obtained by using a polar algorithm. This algorithm creates two random values at a time. It
involves finding a random point in the unit circle by generating uniformly distributed points [-1,1] x [-1,1]
square and rejecting any points outside the circle.
Basics of the polar algorithm:
- Generate two random numbers v1 and v2
- Let v1 = 2 * v1 - 1, v2 = 2 * v2 - 1, and v12 = v1 * v1 + v2 + v2
- If vl2 > 1, regenerate v1 and v2
Testing the Normal Distribution Method
To test the Normal Distribution method, a new static method has been added. The TestNormalDistribution() method has
been written and executed. No additional code is shown.
For the test, two parameters were set:
number of bins = 20; (nBins)
number of points = 1000; (nPoints)
where the parameter (nBins) is the number of bins in the histogram and (nPoints)
is the number of random points. Then a random array is created with a normal distribution. Finally, a comparison is made between
the histogram of random data and the theoretical probability density function of the normal distribution. One can see that the
results from the normal random generator are very close to the theoretical normal distribution function.
Running this example generates the results shown above.
static void TestNormalDistribution();
for (int i = 0; i < nBins; i++)
ListBox1.Items.Add(" x = " + xdata[i] + "," + " - - - - -> Normal random data = " + ydata[i] + "," + " - - - - -> Normal Distribution = " + Math.Round(ydistribution[i] * normalizeFactor,0).ToString());