Extreme Optimization™: Complexity made simple.

Math and Statistics
Libraries for .NET

  • Home
  • Features
    • Math Library
    • Vector and Matrix Library
    • Statistics Library
    • Performance
    • Usability
  • Documentation
    • Introduction
    • Math Library User's Guide
    • Vector and Matrix Library User's Guide
    • Data Analysis Library User's Guide
    • Statistics Library User's Guide
    • Reference
  • Resources
    • Downloads
    • QuickStart Samples
    • Sample Applications
    • Frequently Asked Questions
    • Technical Support
  • Order
  • Company
    • About us
    • Testimonials
    • Customers
    • Press Releases
    • Careers
    • Partners
    • Contact us
Introduction
Deployment Guide
Nuget packages
Configuration
Using Parallelism
Expand Mathematics Library User's GuideMathematics Library User's Guide
Expand Vector and Matrix Library User's GuideVector and Matrix Library User's Guide
Expand Data Analysis Library User's GuideData Analysis Library User's Guide
Expand Statistics Library User's GuideStatistics Library User's Guide
Expand Data Access Library User's GuideData Access Library User's Guide
Expand ReferenceReference

Skip Navigation LinksHome»Documentation»Statistics Library User's Guide»Continuous Distributions»The Chi Square Distribution

The Chi Square Distribution

Extreme Optimization Numerical Libraries for .NET Professional

The chi square (χ2) distribution with n degrees of freedom models the distribution of the sum of the squares of n independent normal variables. It is best known for its use in the Testing Goodness-Of-Fit, and for the one sample Testing Variances of a sample. The chi square distribution is a special case of the The Gamma Distribution.

The chi square distribution has one parameter: the degrees of freedom. This value is usually an integer, but this is not an absolute requirement. The probability density function (PDF) is:

Probability density of the Chi square distribution.

where n is the degrees of freedom.

The chi square distribution is a special case of the gamma distribution, with scale parameter 2 and shape parameter n/2.

The chi square distribution is implemented by the ChiSquareDistribution class. It has one constructor which takes the degrees of freedom as its only argument. The following constructs a chi square distribution with 10 degrees of freedom:

C#
VB
C++
F#
Copy
var chiSquare = new ChiSquareDistribution(10);
Dim chiSquare = New ChiSquareDistribution(10)

No code example is currently available or this language may not be supported.

let chiSquare = ChiSquareDistribution(10.0)

The ChiSquareDistribution class has one specific property, DegreesOfFreedom, that returns the degrees of freedom of the distribution.

ChiSquareDistribution has one static (Shared in Visual Basic) method, Sample, which generates a random sample using a user-supplied uniform random number generator.

C#
VB
C++
F#
Copy
var random = new MersenneTwister();
double sample = ChiSquareDistribution.Sample(random, 10);
Dim random = New MersenneTwister()
Dim sample = ChiSquareDistribution.Sample(random, 10)

No code example is currently available or this language may not be supported.

let random = MersenneTwister()
let sample = ChiSquareDistribution.Sample(random, 10.0)

The above example uses the MersenneTwister to generate uniform random numbers.

For details of the properties and methods common to all continuous distribution classes, see the topic on continuous distributions..

See Also

Other Resources

The Gamma Distribution
Testing Variances

Copyright (c) 2004-2023 ExoAnalytics Inc.

Send comments on this topic to support@extremeoptimization.com

Copyright © 2004-2023, Extreme Optimization. All rights reserved.
Extreme Optimization, Complexity made simple, M#, and M Sharp are trademarks of ExoAnalytics Inc.
Microsoft, Visual C#, Visual Basic, Visual Studio, Visual Studio.NET, and the Optimized for Visual Studio logo
are registered trademarks of Microsoft Corporation.