theplu::yat::statistics::tScore Class Reference

Class for Fisher's t-test. More...

#include <yat/statistics/tScore.h>

Inheritance diagram for theplu::yat::statistics::tScore:

theplu::yat::statistics::Score

List of all members.

Public Member Functions

 tScore (bool absolute=true)
 Default Constructor.
double score (const classifier::Target &target, const utility::VectorBase &value) const
double score (const classifier::Target &target, const utility::VectorBase &value, double *dof) const
double score (const classifier::Target &target, const classifier::DataLookupWeighted1D &value, double *dof=0) const
double score (const classifier::Target &target, const classifier::DataLookupWeighted1D &value) const
double score (const classifier::Target &target, const utility::VectorBase &value, const utility::VectorBase &weight) const
double score (const classifier::Target &target, const utility::VectorBase &value, const utility::VectorBase &weight, double *dof=0) const
template<typename T1, typename T2>
double score (const T1 &pos, const T2 &neg, double *dof=0) const
void absolute (bool absolute)
 Function changing mode of Score.
virtual double score (const classifier::Target &target, const classifier::DataLookup1D &value) const
double score (const classifier::Target &target, const classifier::DataLookup1D &value, const classifier::DataLookup1D &weight) const

Protected Attributes

bool absolute_


Detailed Description

Class for Fisher's t-test.

See http://en.wikipedia.org/wiki/Student's_t-test for more details on the t-test.


Member Function Documentation

double theplu::yat::statistics::tScore::score ( const classifier::Target target,
const utility::VectorBase value 
) const [virtual]

Calculates the value of t-score, i.e. the ratio between difference in mean and standard deviation of this difference. $ t = \frac{ m_x - m_y } {s\sqrt{\frac{1}{n_x}+\frac{1}{n_y}}} $ where $ m $ is the mean, $ n $ is the number of data points and $ s^2 = \frac{ \sum_i (x_i-m_x)^2 + \sum_i (y_i-m_y)^2 }{ n_x + n_y - 2 } $

Returns:
t-score. If absolute=true absolute value of t-score is returned

Implements theplu::yat::statistics::Score.

double theplu::yat::statistics::tScore::score ( const classifier::Target target,
const utility::VectorBase value,
double *  dof 
) const

Calculates the value of t-score, i.e. the ratio between difference in mean and standard deviation of this difference. $ t = \frac{ m_x - m_y } {s\sqrt{\frac{1}{n_x}+\frac{1}{n_y}}} $ where $ m $ is the mean, $ n $ is the number of data points and $ s^2 = \frac{ \sum_i (x_i-m_x)^2 + \sum_i (y_i-m_y)^2 }{ n_x + n_y - 2 } $

Parameters:
target Target defining the two groups
value Vector with data points on which calculation is based
dof double pointer in which approximation of degrees of freedom is returned: pos.n()+neg.n()-2. See AveragerWeighted.
Returns:
t-score. If absolute=true absolute value of t-score is returned

double theplu::yat::statistics::tScore::score ( const classifier::Target target,
const classifier::DataLookupWeighted1D value,
double *  dof = 0 
) const

Calculates the weighted t-score, i.e. the ratio between difference in mean and standard deviation of this difference. $ t = \frac{ m_x - m_y }{ s\sqrt{\frac{1}{n_x}+\frac{1}{n_y}}} $ where $ m $ is the weighted mean, n is the weighted version of number of data points $ \frac{\left(\sum w_i\right)^2}{\sum w_i^2} $, and $ s^2 $ is an estimation of the variance $ s^2 = \frac{ \sum_i w_i(x_i-m_x)^2 + \sum_i w_i(y_i-m_y)^2 }{ n_x + n_y - 2 } $. See AveragerWeighted for details.

Parameters:
target Target defining the two groups
value Vector with values/weights on which calculation is based
dof double pointer in which approximation of degrees of freedom is returned: pos.n()+neg.n()-2. See AveragerWeighted.
Returns:
t-score. If absolute=true absolute value of t-score is returned

double theplu::yat::statistics::tScore::score ( const classifier::Target target,
const classifier::DataLookupWeighted1D value 
) const [virtual]

Calculates the weighted t-score, i.e. the ratio between difference in mean and standard deviation of this difference. $ t = \frac{ m_x - m_y }{ s\sqrt{\frac{1}{n_x}+\frac{1}{n_y}}} $ where $ m $ is the weighted mean, n is the weighted version of number of data points $ \frac{\left(\sum w_i\right)^2}{\sum w_i^2} $, and $ s^2 $ is an estimation of the variance $ s^2 = \frac{ \sum_i w_i(x_i-m_x)^2 + \sum_i w_i(y_i-m_y)^2 }{ n_x + n_y - 2 } $. See AveragerWeighted for details.

Returns:
t-score. If absolute=true absolute value of t-score is returned

Reimplemented from theplu::yat::statistics::Score.

double theplu::yat::statistics::tScore::score ( const classifier::Target target,
const utility::VectorBase value,
const utility::VectorBase weight 
) const [virtual]

Calculates the weighted t-score, i.e. the ratio between difference in mean and standard deviation of this difference. $ t = \frac{ m_x - m_y }{ \frac{s2}{n_x}+\frac{s2}{n_y}} $ where $ m $ is the weighted mean, n is the weighted version of number of data points and $ s2 $ is an estimation of the variance $ s^2 = \frac{ \sum_i w_i(x_i-m_x)^2 + \sum_i w_i(y_i-m_y)^2 }{ n_x + n_y - 2 } $. See AveragerWeighted for details.

Returns:
t-score if absolute=true absolute value of t-score is returned

Implements theplu::yat::statistics::Score.

double theplu::yat::statistics::tScore::score ( const classifier::Target target,
const utility::VectorBase value,
const utility::VectorBase weight,
double *  dof = 0 
) const

Calculates the weighted t-score, i.e. the ratio between difference in mean and standard deviation of this difference. $ t = \frac{ m_x - m_y }{ \frac{s2}{n_x}+\frac{s2}{n_y}} $ where $ m $ is the weighted mean, n is the weighted version of number of data points and $ s2 $ is an estimation of the variance $ s^2 = \frac{ \sum_i w_i(x_i-m_x)^2 + \sum_i w_i(y_i-m_y)^2 }{ n_x + n_y - 2 } $. See AveragerWeighted for details.

Parameters:
target Target defining the two groups
value Vector with data values on which calculation is based
weight Vector with weight associated to value
dof double pointer in which approximation of degrees of freedom is returned: pos.n()+neg.n()-2. See AveragerWeighted.
Returns:
t-score if absolute=true absolute value of t-score is returned

template<typename T1, typename T2>
double theplu::yat::statistics::tScore::score ( const T1 &  pos,
const T2 &  neg,
double *  dof = 0 
) const [inline]

Calcultate t-score from Averager like objects. Requirements for T1 and T2 are: double mean(), double n(), double sum_xx_centered()

If dof is not a null pointer it is assigned to number of degrees of freedom.

virtual double theplu::yat::statistics::Score::score ( const classifier::Target target,
const classifier::DataLookup1D value 
) const [virtual, inherited]

Function calculating the score. In absolute mode, also the score using negated class labels is calculated, and the largest of the two scores are calculated.

value is copied to a utility::vector and that operator is called. If speed is important this operator should be implemented in inherited class to avoid copying.

Returns:
score

double theplu::yat::statistics::Score::score ( const classifier::Target target,
const classifier::DataLookup1D value,
const classifier::DataLookup1D weight 
) const [inherited]

Function calculating the weighted version of score. In absolute mode, also the score using negated class labels is calculated, and the largest of the two scores are calculated. Absolute mode should be used when two-tailed test is wanted.

value and weight are copied to utility::vector and the corresponding operator is called. If speed is important this operator should be implemented in inherited class to avoid copying.


Member Data Documentation

bool theplu::yat::statistics::Score::absolute_ [protected, inherited]

true if method is absolute, which means if score is below expected value (by chance) E, score returns E-score+E instead.


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

Generated on Tue Jan 18 02:20:11 2011 for yat by  doxygen 1.5.5