ChiSquareDistribution Class 
Namespace: Accord.Statistics.Distributions.Univariate
[SerializableAttribute] public class ChiSquareDistribution : UnivariateContinuousDistribution, ISampleableDistribution<double>, IDistribution<double>, IDistribution, ICloneable, IRandomNumberGenerator<double>
The ChiSquareDistribution type exposes the following members.
Name  Description  

ChiSquareDistribution 
Constructs a new ChiSquare distribution
with given degrees of freedom.
 
ChiSquareDistribution(Int32) 
Constructs a new ChiSquare distribution
with given degrees of freedom.

Name  Description  

DegreesOfFreedom 
Gets the Degrees of Freedom for this distribution.
 
Entropy 
Gets the entropy for this distribution.
(Overrides UnivariateContinuousDistributionEntropy.)  
Mean 
Gets the mean for this distribution.
(Overrides UnivariateContinuousDistributionMean.)  
Median 
Gets the median for this distribution.
(Inherited from UnivariateContinuousDistribution.)  
Mode 
Gets the mode for this distribution.
(Overrides UnivariateContinuousDistributionMode.)  
Quartiles 
Gets the Quartiles for this distribution.
(Inherited from UnivariateContinuousDistribution.)  
StandardDeviation 
Gets the Standard Deviation (the square root of
the variance) for the current distribution.
(Inherited from UnivariateContinuousDistribution.)  
Support 
Gets the support interval for this distribution.
(Overrides UnivariateContinuousDistributionSupport.)  
Variance 
Gets the variance for this distribution.
(Overrides UnivariateContinuousDistributionVariance.) 
Name  Description  

Clone 
Creates a new object that is a copy of the current instance.
(Overrides DistributionBaseClone.)  
ComplementaryDistributionFunction 
Gets the complementary cumulative distribution function
(ccdf) for the χ² distribution evaluated at point x.
This function is also known as the Survival function.
(Overrides UnivariateContinuousDistributionComplementaryDistributionFunction(Double).)  
CumulativeHazardFunction 
Gets the cumulative hazard function for this
distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)  
DistributionFunction(Double) 
Gets the cumulative distribution function (cdf) for
the χ² distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionDistributionFunction(Double).)  
DistributionFunction(Double, Double) 
Gets the cumulative distribution function (cdf) for this
distribution in the semiclosed interval (a; b] given as
P(a < X ≤ b).
(Inherited from UnivariateContinuousDistribution.)  
Equals  Determines whether the specified object is equal to the current object. (Inherited from Object.)  
Finalize  Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)  
Fit(Double) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Fit(Double, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Fit(Double, Double) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Fit(Double, Int32) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Fit(Double, Double, IFittingOptions) 
This method is not supported.
(Overrides UnivariateContinuousDistributionFit(Double, Double, IFittingOptions).)  
Fit(Double, Int32, IFittingOptions) 
Fits the underlying distribution to a given set of observations.
(Inherited from UnivariateContinuousDistribution.)  
Generate 
Generates a random observation from the current distribution.
(Overrides UnivariateContinuousDistributionGenerate.)  
Generate(Int32) 
Generates a random vector of observations from the current distribution.
(Inherited from UnivariateContinuousDistribution.)  
Generate(Int32, Double) 
Generates a random vector of observations from the current distribution.
(Overrides UnivariateContinuousDistributionGenerate(Int32, Double).)  
GetHashCode  Serves as the default hash function. (Inherited from Object.)  
GetRange 
Gets the distribution range within a given percentile.
(Inherited from UnivariateContinuousDistribution.)  
GetType  Gets the Type of the current instance. (Inherited from Object.)  
HazardFunction 
Gets the hazard function, also known as the failure rate or
the conditional failure density function for this distribution
evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)  
Inverse 
Gets the inverse of the cumulative distribution function (icdf) for
this distribution evaluated at probability p. This function
is also known as the Quantile function.
 
InverseDistributionFunction 
Gets the inverse of the cumulative distribution function (icdf) for
this distribution evaluated at probability p. This function
is also known as the Quantile function.
(Overrides UnivariateContinuousDistributionInverseDistributionFunction(Double).)  
LogCumulativeHazardFunction 
Gets the log of the cumulative hazard function for this
distribution evaluated at point x.
(Inherited from UnivariateContinuousDistribution.)  
LogProbabilityDensityFunction 
Gets the logprobability density function (pdf) for
this distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionLogProbabilityDensityFunction(Double).)  
MemberwiseClone  Creates a shallow copy of the current Object. (Inherited from Object.)  
ProbabilityDensityFunction 
Gets the probability density function (pdf) for
the χ² distribution evaluated at point x.
(Overrides UnivariateContinuousDistributionProbabilityDensityFunction(Double).)  
QuantileDensityFunction 
Gets the first derivative of the
inverse distribution function (icdf) for this distribution evaluated
at probability p.
(Inherited from UnivariateContinuousDistribution.)  
Random(Int32) 
Generates a random observation from the
ChiSquare distribution with the given parameters.
 
Random(Int32, Int32) 
Generates a random vector of observations from the
ChiSquare distribution with the given parameters.
 
ToString 
Returns a String that represents this instance.
(Inherited from DistributionBase.)  
ToString(IFormatProvider) 
Returns a String that represents this instance.
(Inherited from DistributionBase.)  
ToString(String) 
Returns a String that represents this instance.
(Inherited from DistributionBase.)  
ToString(String, IFormatProvider) 
Returns a String that represents this instance.
(Overrides DistributionBaseToString(String, IFormatProvider).) 
Name  Description  

HasMethod 
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)  
IsEqual  Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices. (Defined by Matrix.)  
ToT  Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)  
ToT  Overloaded.
Converts an object into another type, irrespective of whether
the conversion can be done at compile time or not. This can be
used to convert generic types to numeric types during runtime.
(Defined by Matrix.) 
In probability theory and statistics, the chisquare distribution (also chisquared or χ²distribution) with k degrees of freedom is the distribution of a sum of the squares of k independent standard normal random variables. It is one of the most widely used probability distributions in inferential statistics, e.g. in hypothesis testing, or in construction of confidence intervals.
References:
The following example demonstrates how to create a new χ² distribution with the given degrees of freedom.
// Create a new χ² distribution with 7 d.f. var chisq = new ChiSquareDistribution(degreesOfFreedom: 7); // Common measures double mean = chisq.Mean; // 7 double median = chisq.Median; // 6.345811195595612 double var = chisq.Variance; // 14 // Cumulative distribution functions double cdf = chisq.DistributionFunction(x: 6.27); // 0.49139966433823956 double ccdf = chisq.ComplementaryDistributionFunction(x: 6.27); // 0.50860033566176044 double icdf = chisq.InverseDistributionFunction(p: cdf); // 6.2700000000852318 // Probability density functions double pdf = chisq.ProbabilityDensityFunction(x: 6.27); // 0.11388708001184455 double lpdf = chisq.LogProbabilityDensityFunction(x: 6.27); // 2.1725478476948092 // Hazard (failure rate) functions double hf = chisq.HazardFunction(x: 6.27); // 0.22392254197721179 double chf = chisq.CumulativeHazardFunction(x: 6.27); // 0.67609276602233315 // String representation string str = chisq.ToString(); // "χ²(x; df = 7)