yat  0.13.2pre
Public Member Functions | Protected Attributes | List of all members
theplu::yat::regression::OneDimensionalWeighted Class Referenceabstract

Interface Class for One Dimensional fitting in a weighted fashion. More...

#include <yat/regression/OneDimensionalWeighted.h>

Inheritance diagram for theplu::yat::regression::OneDimensionalWeighted:
theplu::yat::regression::LinearWeighted theplu::yat::regression::NaiveWeighted theplu::yat::regression::PolynomialWeighted

Public Member Functions

 OneDimensionalWeighted (void)
 
virtual ~OneDimensionalWeighted (void)
 
virtual void fit (const utility::VectorBase &x, const utility::VectorBase &y, const utility::VectorBase &w)=0
 
virtual double predict (const double x) const =0
 
double prediction_error2 (const double x, const double w=1.0) const
 
double r2 (void) const
 
virtual double s2 (double w=1) const =0
 
virtual double standard_error2 (const double x) const =0
 

Protected Attributes

statistics::AveragerPairWeighted ap_
 
double chisq_
 Chi-squared. More...
 

Detailed Description

Interface Class for One Dimensional fitting in a weighted fashion.

Constructor & Destructor Documentation

theplu::yat::regression::OneDimensionalWeighted::OneDimensionalWeighted ( void  )

Default Constructor.

virtual theplu::yat::regression::OneDimensionalWeighted::~OneDimensionalWeighted ( void  )
virtual

Destructor

Member Function Documentation

virtual void theplu::yat::regression::OneDimensionalWeighted::fit ( const utility::VectorBase x,
const utility::VectorBase y,
const utility::VectorBase w 
)
pure virtual

This function computes the best-fit given a model (see specific class for details) by minimizing $ \sum{w_i(\hat{y_i}-y_i)^2} $, where $ \hat{y} $ is the fitted value. The weight $ w_i $ should be proportional to the inverse of the variance for $ y_i $

Implemented in theplu::yat::regression::LinearWeighted, theplu::yat::regression::NaiveWeighted, and theplu::yat::regression::PolynomialWeighted.

virtual double theplu::yat::regression::OneDimensionalWeighted::predict ( const double  x) const
pure virtual
Returns
expected value in x according to the fitted model

Implemented in theplu::yat::regression::LinearWeighted, theplu::yat::regression::PolynomialWeighted, and theplu::yat::regression::NaiveWeighted.

double theplu::yat::regression::OneDimensionalWeighted::prediction_error2 ( const double  x,
const double  w = 1.0 
) const

The prediction error is defined as expected squared deviation a new data point (with weight w) will be from the model value $ E((Y|x - \hat{y}(x))^2|w) $ and is typically divided into the conditional variance ( see s2() ) given $ x $ and the squared standard error ( see standard_error2() ) of the model estimation in $ x $.

$ E((Y|x - E(Y|x))^2|w) + E((E(Y|x) - \hat{y}(x))^2) $

Returns
expected prediction error for a new data point in x with weight w.
double theplu::yat::regression::OneDimensionalWeighted::r2 ( void  ) const

r2 is defined as $ \frac{\sum w_i(y_i-\hat{y}_i)^2}{\sum w_i(y_i-m_y)^2} $ or the fraction of the variance explained by the regression model.

virtual double theplu::yat::regression::OneDimensionalWeighted::s2 ( double  w = 1) const
pure virtual

$ s^2 $ is the estimation of variance of residuals or equivalently the conditional variance of Y.

Returns
Conditional variance of Y

Implemented in theplu::yat::regression::LinearWeighted, theplu::yat::regression::NaiveWeighted, and theplu::yat::regression::PolynomialWeighted.

virtual double theplu::yat::regression::OneDimensionalWeighted::standard_error2 ( const double  x) const
pure virtual

The standard error is defined as $ E((Y|x,w - \hat{y}(x))^2) $

Returns
error of model value in x

Implemented in theplu::yat::regression::LinearWeighted, theplu::yat::regression::NaiveWeighted, and theplu::yat::regression::PolynomialWeighted.

Member Data Documentation

statistics::AveragerPairWeighted theplu::yat::regression::OneDimensionalWeighted::ap_
protected

Averager for pair of x and y

double theplu::yat::regression::OneDimensionalWeighted::chisq_
protected

Chi-squared.

Chi-squared is defined as the $ \sum{w_i(\hat{y_i}-y_i)^2} $


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

Generated on Wed Jan 4 2017 02:23:08 for yat by  doxygen 1.8.5