LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::studentDistribution Class Reference

The Student t-test compares the means of two normally distributed samples of sizes n1 and n2, assuming that their unknown variances are equal. More...

#include <ltiStudentDistribution.h>

Inheritance diagram for lti::studentDistribution:
Inheritance graph
[legend]
Collaboration diagram for lti::studentDistribution:
Collaboration graph
[legend]

List of all members.

Classes

class  parameters
 The parameters for the class studentDistribution. More...

Public Member Functions

 studentDistribution ()
 studentDistribution (const parameters &par)
 studentDistribution (const studentDistribution &other)
virtual ~studentDistribution ()
virtual const char * getTypeName () const
bool apply (const int n, const float &tValue, float &confidence) const
float bound (const int n) const
bool accept (const int n, const float &tValue)
bool acceptLUT (const int n, const float &tValue)
bool acceptCompute (const int n, const float &tValue) const
studentDistributioncopy (const studentDistribution &other)
studentDistributionoperator= (const studentDistribution &other)
virtual functorclone () const
const parametersgetParameters () const
bool generateLUT ()

Protected Member Functions

float computeBound (const int n, const float &alpha) const
float distribution (const int n, const float &tValue) const

Protected Attributes

float alpha_
std::vector< float > lut_

Detailed Description

The Student t-test compares the means of two normally distributed samples of sizes n1 and n2, assuming that their unknown variances are equal.

If the test value is bigger than T(k,alpha), k=n1+n2-2, then the equality hypothesis is rejected at significance level alpha.

This class only computes T(k,alpha). Computing the test value is left to the application. For efficiency, e.g. if testing many times in a row with varying degrees of freedom the values T(k,alpha) may be precomputed for a constant significance level alpha and stored in a LUT.


Constructor & Destructor Documentation

lti::studentDistribution::studentDistribution (  ) 

Default constructor.

lti::studentDistribution::studentDistribution ( const parameters par  ) 

Construct a functor using the given parameters.

lti::studentDistribution::studentDistribution ( const studentDistribution other  ) 

Copy constructor.

Parameters:
other the object to be copied
virtual lti::studentDistribution::~studentDistribution (  )  [virtual]

Destructor.


Member Function Documentation

bool lti::studentDistribution::accept ( const int  n,
const float &  tValue 
)

Tests if the hypothesis of equal means is accepted at the significance level given in the parameters.

Depending on the parameter settings this method uses the LUT or computes the result. If the LUT is requested but not initialized properly, it is done here.

Parameters:
n degrees of freedom of the student distribution
tValue t-value computed by your application
Returns:
true if the hypothesis is accepted and false otherwise
bool lti::studentDistribution::acceptCompute ( const int  n,
const float &  tValue 
) const

Tests if the hypothesis of equal means is accepted at the significance level given in the parameters.

The significance for your t-value is computed and compared with the significance level supplied in the parameters.

Parameters:
n degrees of freedom of the student distribution
tValue t-value computed by your application
Returns:
true if the hypothesis is accepted and false otherwise
bool lti::studentDistribution::acceptLUT ( const int  n,
const float &  tValue 
) [inline]

Tests if the hypothesis of equal means is accepted at the significance level given in the parameters.

The appropriate bound of Student's t-distribution is taken from a pre-computed LUT.

CAUTION: This method does not check if the LUT is initialized, nor does it check that the LUT has been computed for the current significance level. To initialize it please call generateLUT().

Parameters:
n degrees of freedom of the student distribution
tValue t-value computed by your application
Returns:
true if the hypothesis is accepted and false otherwise

References _lti_debug, lut_, and lti::status::setStatusString().

bool lti::studentDistribution::apply ( const int  n,
const float &  tValue,
float &  confidence 
) const

Computes Student's distribution probability function for a given degree of freedom and t-value, which code the similarity of the two sample means.

Parameters:
n degrees of freedom of the student distribution
tValue t-value computed by your aplication
confidence the result, i.e. the probability that the two sample means are similar
Returns:
true on success and false otherwise
float lti::studentDistribution::bound ( const int  n  )  const

Compute the lowest t-value, for which the hypothesis is rejected.

Parameters:
n degrees of freedom of the student distribution
Returns:
the lowest t-value for which the hypothesis is rejected.
virtual functor* lti::studentDistribution::clone (  )  const [virtual]

Returns a pointer to a clone of this functor.

Reimplemented from lti::mathFunction.

float lti::studentDistribution::computeBound ( const int  n,
const float &  alpha 
) const [protected]

Compute the lowest t-value, for which the hypothesis is rejected.

Parameters:
n degrees of freedom of the student distribution
alpha confidence value
Returns:
the lowest t-value for which the hypothesis is rejected.
studentDistribution& lti::studentDistribution::copy ( const studentDistribution other  ) 

Copy data of "other" functor.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::mathFunction.

float lti::studentDistribution::distribution ( const int  n,
const float &  tValue 
) const [protected]

Compute the Student distribution probability function for a given n (degrees of freedom) and t-value.

Parameters:
n degrees of freedom of the student distribution
tValue t-value computed by your application
Returns:
the two sided confidence
bool lti::studentDistribution::generateLUT (  ) 

Generates the LUT.

const parameters& lti::studentDistribution::getParameters (  )  const

Returns used parameters.

Reimplemented from lti::mathFunction.

virtual const char* lti::studentDistribution::getTypeName (  )  const [virtual]

Returns the name of this type ("studentDistribution").

Reimplemented from lti::mathFunction.

studentDistribution& lti::studentDistribution::operator= ( const studentDistribution other  ) 

Alias for copy member.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::mathFunction.


Member Data Documentation

Remember the significance level for which the LUT has been computed.

Normed to one-sided.

std::vector<float> lti::studentDistribution::lut_ [protected]

The LUT.

Due to computational expensive of the used algorithm double does not make any sense here.

Referenced by acceptLUT().


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

Generated on Sat Apr 10 15:28:46 2010 for LTI-Lib by Doxygen 1.6.1