STK++ 0.9.13

ChiSquared distribution law. More...

#include <STK_Law_ChiSquared.h>

Inheritance diagram for STK::Law::ChiSquared:
Inheritance graph

Public Types

typedef IUnivLaw< RealBase
 

Public Member Functions

 ChiSquared (int df=1)
 Default constructor.
 
virtual ~ChiSquared ()
 destructor
 
int df () const
 
void setDf (int df)
 
virtual Real rand () const
 
virtual Real pdf (Real const &x) const
 
virtual Real lpdf (Real const &x) const
 
virtual Real cdf (Real const &t) const
 
virtual Real icdf (Real const &p) const
 
- Public Member Functions inherited from STK::Law::IUnivLaw< Real >
virtual ~IUnivLaw ()
 Virtual destructor.
 
virtual Real lcdf (Real const &t) const
 compute the lower tail log-cumulative distribution function Give the log-probability that a random variate is less or equal to t.
 
virtual Real cdfc (Real const &t) const
 calculate the complement of cumulative distribution function, called in statistics the survival function.
 
virtual Real lcdfc (Real const &t) const
 calculate the log-complement of cumulative distribution function Give the log-probability that a random variate is greater than t.
 
- Public Member Functions inherited from STK::Law::ILawBase
String constname () const
 

Static Public Member Functions

static Real rand (int df)
 
static Real pdf (Real const &x, int df)
 
static Real lpdf (Real const &x, int df)
 
static Real cdf (Real const &t, int df)
 
static Real icdf (Real const &p, int df)
 

Protected Attributes

int df_
 degree of freedom
 
- Protected Attributes inherited from STK::Law::ILawBase
String name_
 Name of the Law.
 

Additional Inherited Members

- Protected Member Functions inherited from STK::Law::IUnivLaw< Real >
 IUnivLaw (String const &name)
 Constructor.
 
 IUnivLaw (IUnivLaw const &law)
 copy Constructor.
 
- Protected Member Functions inherited from STK::Law::ILawBase
 ILawBase (String const &name)
 Constructor.
 
 ~ILawBase ()
 destructor.
 

Detailed Description

ChiSquared distribution law.

In probability theory and statistics, the chi-squared distribution with k degrees of freedom is the distribution of a sum of the squares of k independent standard normal random variables. It is a special case of the gamma distribution and is one of the most widely used probability distributions in inferential statistics, e.g., in hypothesis testing or in construction of confidence intervals.

The probability density function (pdf) of the chi-squared distribution with n degree of freedom is

\[
 f(x;n) = \frac{ x^(n/2-1) e^(-x/2)}{2^(n/2) \Gamma(n/2)}
 \ \mathrm{ for }\ x > 0\ \mathrm{ and }\ n \geq 0.
\]

Definition at line 62 of file STK_Law_ChiSquared.h.

Member Typedef Documentation

◆ Base

Constructor & Destructor Documentation

◆ ChiSquared()

STK::Law::ChiSquared::ChiSquared ( int  df = 1)
inline

Default constructor.

Parameters
dfdegree of freedom parameter

Definition at line 69 of file STK_Law_ChiSquared.h.

69 : Base(_T("Chi-squared")), df_(df)
70 { if (df<=0) STKDOMAIN_ERROR_1ARG(ChiSquared::ChiSquared,df,df must be > 0);}
#define STKDOMAIN_ERROR_1ARG(Where, Arg, Error)
Definition STK_Macros.h:165
#define _T(x)
Let x unmodified.
int df_
degree of freedom
ChiSquared(int df=1)
Default constructor.

References ChiSquared(), df(), and STKDOMAIN_ERROR_1ARG.

Referenced by ChiSquared().

◆ ~ChiSquared()

virtual STK::Law::ChiSquared::~ChiSquared ( )
inlinevirtual

destructor

Definition at line 72 of file STK_Law_ChiSquared.h.

72{}

Member Function Documentation

◆ cdf() [1/2]

Real STK::Law::ChiSquared::cdf ( Real const t) const
virtual
Returns
the cumulative distribution function
Parameters
ta positive real value

Implements STK::Law::IUnivLaw< Real >.

Definition at line 68 of file STK_Law_ChiSquared.cpp.

69{
70 return 0.;
71}

◆ cdf() [2/2]

Real STK::Law::ChiSquared::cdf ( Real const t,
int  df 
)
static
Returns
the cumulative distribution function
Parameters
ta positive real value
dfdegree of freedom parameter

Definition at line 111 of file STK_Law_ChiSquared.cpp.

112{
113 return 0.;
114}

◆ df()

int STK::Law::ChiSquared::df ( ) const
inline
Returns
the number of degree of freedom

Definition at line 74 of file STK_Law_ChiSquared.h.

74{ return df_;}

References df_.

Referenced by ChiSquared(), and setDf().

◆ icdf() [1/2]

Real STK::Law::ChiSquared::icdf ( Real const p) const
virtual
Returns
the inverse cumulative distribution function
Parameters
pa probability number

Implements STK::Law::IUnivLaw< Real >.

Definition at line 76 of file STK_Law_ChiSquared.cpp.

77{
78 return 0.;
79}

◆ icdf() [2/2]

Real STK::Law::ChiSquared::icdf ( Real const p,
int  df 
)
static
Returns
the inverse cumulative distribution function
Parameters
pa probability number
dfdegree of freedom parameter

Definition at line 120 of file STK_Law_ChiSquared.cpp.

121{
122 return 0.;
123}

◆ lpdf() [1/2]

Real STK::Law::ChiSquared::lpdf ( Real const x) const
virtual
Returns
the value of the log-pdf
Parameters
xa positive real value

Reimplemented from STK::Law::IUnivLaw< Real >.

Definition at line 60 of file STK_Law_ChiSquared.cpp.

61{
62 return 0.;
63}

◆ lpdf() [2/2]

Real STK::Law::ChiSquared::lpdf ( Real const x,
int  df 
)
static
Returns
the value of the log-pdf
Parameters
xa positive real value
dfdegree of freedom parameter

Definition at line 102 of file STK_Law_ChiSquared.cpp.

103{
104 return 0.;
105}

◆ pdf() [1/2]

Real STK::Law::ChiSquared::pdf ( Real const x) const
virtual
Returns
the value of the pdf
Parameters
xa positive real value

Implements STK::Law::IUnivLaw< Real >.

Definition at line 55 of file STK_Law_ChiSquared.cpp.

56{
57 return 0.;
58}

◆ pdf() [2/2]

Real STK::Law::ChiSquared::pdf ( Real const x,
int  df 
)
static
Returns
the value of the pdf
Parameters
xa positive real value
dfdegree of freedom parameter

Definition at line 93 of file STK_Law_ChiSquared.cpp.

94{
95 return 0.;
96}

◆ rand() [1/2]

Real STK::Law::ChiSquared::rand ( ) const
virtual
Returns
a pseudo ChiSquared random variate.

Implements STK::Law::IUnivLaw< Real >.

Definition at line 48 of file STK_Law_ChiSquared.cpp.

49{
50 return 0.;
51}

◆ rand() [2/2]

Real STK::Law::ChiSquared::rand ( int  df)
static
Returns
a pseudo ChiSquared random variate with the specified parameters.
Parameters
dfdegree of freedom parameter

Definition at line 84 of file STK_Law_ChiSquared.cpp.

85{
86 return 0.;
87}

◆ setDf()

void STK::Law::ChiSquared::setDf ( int  df)
inline
Parameters
dfdegree of freedom parameter

Definition at line 76 of file STK_Law_ChiSquared.h.

77 {
78 if (df<=0) STKDOMAIN_ERROR_1ARG(ChiSquared::setShape,df,shape must be > 0);
79 df_ = df;
80 }

References df(), df_, and STKDOMAIN_ERROR_1ARG.

Member Data Documentation

◆ df_

int STK::Law::ChiSquared::df_
protected

degree of freedom

Definition at line 136 of file STK_Law_ChiSquared.h.

Referenced by df(), and setDf().


The documentation for this class was generated from the following files: