Site Statistics  |   Contact  |   About Us       Tuesday, September 21, 2021

HOME â€º  AREAS OF EXPERTISE â€º   Distribution Function â€º  ~ Chi and Chi-Square

 "Distribution Functions" Chi and Chi-Square Distribution Method
 Chi Distribution Results x = 0.1, - - - - -> Random Data = 79, - - - - -> Density Distribution = 82 x = 0.3, - - - - -> Random Data = 220, - - - - -> Density Distribution = 228 x = 0.5, - - - - -> Random Data = 356, - - - - -> Density Distribution = 323 x = 0.7, - - - - -> Random Data = 344, - - - - -> Density Distribution = 356 x = 0.9, - - - - -> Random Data = 292, - - - - -> Density Distribution = 332 x = 1.1, - - - - -> Random Data = 260, - - - - -> Density Distribution = 272 x = 1.3, - - - - -> Random Data = 204, - - - - -> Density Distribution = 199 x = 1.5, - - - - -> Random Data = 109, - - - - -> Density Distribution = 131 x = 1.7, - - - - -> Random Data = 65, - - - - -> Density Distribution = 78 x = 1.9, - - - - -> Random Data = 32, - - - - -> Density Distribution = 43 x = 2.1, - - - - -> Random Data = 22, - - - - -> Density Distribution = 21 x = 2.3, - - - - -> Random Data = 9, - - - - -> Density Distribution = 10 x = 2.5, - - - - -> Random Data = 5, - - - - -> Density Distribution = 4 x = 2.7, - - - - -> Random Data = 1, - - - - -> Density Distribution = 2 x = 2.9, - - - - -> Random Data = 1, - - - - -> Density Distribution = 1 x = 3.1, - - - - -> Random Data = 1, - - - - -> Density Distribution = 0 x = 3.3, - - - - -> Random Data = 0, - - - - -> Density Distribution = 0 x = 3.5, - - - - -> Random Data = 0, - - - - -> Density Distribution = 0 x = 3.7, - - - - -> Random Data = 0, - - - - -> Density Distribution = 0 x = 3.9, - - - - -> Random Data = 0, - - - - -> Density Distribution = 0

 Chi-Square Distribution Results x = 0.1, - - - - -> Random Data = 185, - - - - -> Density Distribution = 185 x = 0.3, - - - - -> Random Data = 158, - - - - -> Density Distribution = 167 x = 0.5, - - - - -> Random Data = 150, - - - - -> Density Distribution = 151 x = 0.7, - - - - -> Random Data = 143, - - - - -> Density Distribution = 137 x = 0.9, - - - - -> Random Data = 139, - - - - -> Density Distribution = 124 x = 1.1, - - - - -> Random Data = 122, - - - - -> Density Distribution = 112 x = 1.3, - - - - -> Random Data = 107, - - - - -> Density Distribution = 102 x = 1.5, - - - - -> Random Data = 86, - - - - -> Density Distribution = 92 x = 1.7, - - - - -> Random Data = 81, - - - - -> Density Distribution = 83 x = 1.9, - - - - -> Random Data = 64, - - - - -> Density Distribution = 75 x = 2.1, - - - - -> Random Data = 66, - - - - -> Density Distribution = 68 x = 2.3, - - - - -> Random Data = 67, - - - - -> Density Distribution = 62 x = 2.5, - - - - -> Random Data = 59, - - - - -> Density Distribution = 56 x = 2.7, - - - - -> Random Data = 32, - - - - -> Density Distribution = 50 x = 2.9, - - - - -> Random Data = 62, - - - - -> Density Distribution = 46 x = 3.1, - - - - -> Random Data = 48, - - - - -> Density Distribution = 41 x = 3.3, - - - - -> Random Data = 39, - - - - -> Density Distribution = 37 x = 3.5, - - - - -> Random Data = 43, - - - - -> Density Distribution = 34 x = 3.7, - - - - -> Random Data = 23, - - - - -> Density Distribution = 31 x = 3.9, - - - - -> Random Data = 33, - - - - -> Density Distribution = 28

 Number of Points: Number of Bins: [ Initial Number of Bins: {20) ] [ Initial Number of Points: {2000} ]

IMPLEMENTATION
Chi and Chi-Square Distribution Method

The Chi and Chi-Square Distributions are continous probability distributions. The distribution usually arises when an n-dimensional vector's orthogonal components are independent and each follows a standard normal distribution.

Probability Density Function

The Chi (or ε) probability density function is expressed in terms of the formula:

 f(x;n,δ) = [ 2 (n/2)n/2 xn-1 en/2δx2  /   γ(n/2) εn

where γ is the gamma function.

The Chi square (or ε2) probability density function is defined by

 f(x;n,δ) = xn/2 - 1 e n/2γ2 * x2  /   2n/2 γ(n/2) γn

Chi and Chi-Square Random Number Generators

The Chi square random distribution with parameters n and γ is equal to the sum squares of n independent normal random distribution:

 γ2 (n,γ) = ∑i=1n [Ni (0,γ2)]2

The Chi random distribution can be calculated from the above Chi square random distribution:

 γ(n,ε) = √ γ2 (n,ε)/ n

Testing the Chi and Chi-Square Distribution Method

To test the Chi and Chi-Square Distribution method, a new static method has been added. The TestChiAndChi-SquareDistribution() method has been written and executed. No additional code is shown. The user can change variables as desired.

For the test, two parameters were set:

 number of bins = 20; (nBins) number of points = 2000; (nPoints)

where the parameter (nBins) is the number of bins in the histogram and (nPoints) is the number of random points. A random array is created using the Chi and Chi-Square distribution. A comparison is made between the histogram of random data and the theoretical probability density function of the Chi and Chi-Square distribution. One can see the results from the exponential random generator are very close to the theoretical Chi and Chi-Square distribution function.

Running this example generates the results shown above.

static void TestChiAndChi-SquareDistribution();
{
for (int i = 0; i < nBins; i++)
{
ListBox1.Items.Add(" x = " + xdata[i] + "," + " - - - - -> Random Data = " + ydata1[i] + "," + " - - - - -> Density Distribution = " + Math.Round(ychi[i] * normalizeFactor1, 0).ToString());
}
}
{
for (int i = 0; i < nBins; i++)
{
ListBox2.Items.Add(" x = " + xdata[i] + "," + " - - - - -> Random Data = " + ydata2[i] + "," + " - - - - -> Density Distribution = " + Math.Round(ychisquare[i] * normalizeFactor2, 0).ToString());
}
}

 Other Implementations...

 Object-Oriented Implementation Graphics and Animation Sample Applications Ore Extraction Optimization Vectors and Matrices Complex Numbers and Functions Ordinary Differential Equations - Euler Method Ordinary Differential Equations 2nd-Order Runge-Kutta Ordinary Differential Equations 4th-Order Runge-Kutta Higher Order Differential Equations Nonlinear Systems Numerical Integration Numerical Differentiation Function Evaluation

Math, Analysis,
expertise..."

EIGENVALUE SOLUTIONS...
Eigen Inverse Iteration
Rayleigh-Quotient Method
Cubic Spline Method

 Applied Mathematical Algorithms
 A complex number z = x + iy, where... Complex Functions Non-linear system methods... Non Linear Systems Construction of differentiation... Differentiation Consider the function where... Integration
 About Us KMP Engineering is an independent multidisciplinary engineering consulting company specializing in mathematical algorithms.  → ABOUT  → SITE STATISTICS Contact Us KMP ENGINEERING 2461 E Orangethorpe Ave Fullerton, CA 92631 USA info@keystoneminingpost.com Site Map  →  Home  →  Areas of Expertise  →  Reference Items  →  Managed Services  →  Login Mining & Software Engineering