Chi2Distribution Class Reference
[Mathematical algorithms]

#include <Chi2Distribution.hpp>

Inheritance diagram for Chi2Distribution:

Inheritance graph
[legend]
Collaboration diagram for Chi2Distribution:

Collaboration graph
[legend]
List of all members.

Detailed Description

This class implements the Chi-square distribution.

A typical way to use this class follows:

      // Declare a 'Chi2Distribution' object with 2 degrees of freedom
   Chi2Distribution chiObj;

   double x(5.7);

   cout << chiObj.pdf(x) << " | "
        << chiObj.cdf(x) << " | "
        << chiObj.Q(x) << endl;

      // Now, the same but with four degrees of freedom
   cout << chiObj.pdf(x, 4) << " | "
        << chiObj.cdf(x, 4) << " | "
        << chiObj.Q(x, 4) << endl;

See also:
SpecialFunctions.hpp for useful functions, and GaussianDistribution.hpp for a normal distribution.

Definition at line 69 of file Chi2Distribution.hpp.

Public Member Functions

 Chi2Distribution ()
 Default constructor. Sets the number of degrees of freedom to 2.
 Chi2Distribution (int n)
 Explicit constructor.
virtual double pdf (double x)
 Computes the probability density function.
virtual double pdf (double x, int n)
 Computes the probability density function.
virtual double cdf (double x)
 Computes the cumulative distribution function.
virtual double cdf (double x, int n)
 Computes the cumulative distribution function.
virtual double Q (double x)
 Computes the upper tail of the Chi-square probability function Q(x, ndf).
virtual double Q (double x, int n)
 Computes the upper tail of the Chi-square probability function Q(x, n).
virtual double getNDF (void) const
 Get number of degrees of freedom.
virtual Chi2DistributionsetNDF (int n) throw (InvalidParameter)
 Set the number of degrees of freedom.


Constructor & Destructor Documentation

Chi2Distribution  )  [inline]
 

Default constructor. Sets the number of degrees of freedom to 2.

Definition at line 75 of file Chi2Distribution.hpp.

Chi2Distribution int  n  )  [inline]
 

Explicit constructor.

Parameters:
n Degrees of freedom
Warning:
"n" must be > 0, otherwise n = |n|.

Definition at line 84 of file Chi2Distribution.hpp.


Member Function Documentation

virtual double cdf double  x,
int  n
[inline, virtual]
 

Computes the cumulative distribution function.

Parameters:
x Value
n Degrees of freedom
Warning:
"n" must be > 0, otherwise n = |n|.

Definition at line 120 of file Chi2Distribution.hpp.

double cdf double  x  )  [virtual]
 

Computes the cumulative distribution function.

Parameters:
x Value

Implements BaseDistribution.

Definition at line 72 of file Chi2Distribution.cpp.

References gpstk::gammaP().

virtual double getNDF void   )  const [inline, virtual]
 

Get number of degrees of freedom.

Definition at line 146 of file Chi2Distribution.hpp.

virtual double pdf double  x,
int  n
[inline, virtual]
 

Computes the probability density function.

Parameters:
x Value
n Degrees of freedom
Warning:
"n" must be > 0, otherwise n = |n|.

Definition at line 102 of file Chi2Distribution.hpp.

double pdf double  x  )  [virtual]
 

Computes the probability density function.

Parameters:
x Value

Implements BaseDistribution.

Definition at line 45 of file Chi2Distribution.cpp.

References gpstk::exp(), gpstk::lngamma(), and gpstk::log().

virtual double Q double  x,
int  n
[inline, virtual]
 

Computes the upper tail of the Chi-square probability function Q(x, n).

Parameters:
x Value
n Degrees of freedom
Warning:
"n" must be > 0, otherwise n = |n|.

Definition at line 141 of file Chi2Distribution.hpp.

virtual double Q double  x  )  [inline, virtual]
 

Computes the upper tail of the Chi-square probability function Q(x, ndf).

Parameters:
x Value

Definition at line 129 of file Chi2Distribution.hpp.

Chi2Distribution & setNDF int  n  )  throw (InvalidParameter) [virtual]
 

Set the number of degrees of freedom.

Parameters:
n Degrees of freedom
Warning:
"n" must be > 0, otherwise n = |n|.

Definition at line 96 of file Chi2Distribution.cpp.

References GPSTK_THROW.


The documentation for this class was generated from the following files:
Generated on Wed Jun 19 03:31:43 2013 for GPS ToolKit Software Library by  doxygen 1.3.9.1