yat  0.10.4pre
Public Member Functions | Protected Attributes
theplu::yat::regression::LinearWeighted Class Reference

linear regression. More...

#include </scratch/bob/jari/tmp/pristine/yat-0.10.x/yat/regression/LinearWeighted.h>

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

List of all members.

Public Member Functions

 LinearWeighted (void)
 The default constructor.
virtual ~LinearWeighted (void)
 The destructor.
double alpha (void) const
double alpha_var (void) const
double beta (void) const
double beta_var (void) const
void fit (const utility::VectorBase &x, const utility::VectorBase &y, const utility::VectorBase &w)
double predict (const double x) const
double s2 (double w=1) const
double standard_error2 (const double x) const
double prediction_error2 (const double x, const double w=1.0) const
double r2 (void) const

Protected Attributes

statistics::AveragerPairWeighted ap_
double chisq_
 Chi-squared.

Detailed Description

linear regression.


Member Function Documentation

double theplu::yat::regression::LinearWeighted::alpha ( void  ) const

$ alpha $ is estimated as $ \frac{\sum w_iy_i}{\sum w_i} $

  @return the parameter \form#172
double theplu::yat::regression::LinearWeighted::alpha_var ( void  ) const

Variance is estimated as $ \frac{s^2}{\sum w_i} $

See also:
s2()
Returns:
variance of parameter $ \alpha $
double theplu::yat::regression::LinearWeighted::beta ( void  ) const

$ beta $ is estimated as $ \frac{\sum w_i(y_i-m_y)(x_i-m_x)}{\sum w_i(x_i-m_x)^2} $

  @return the parameter \form#176
double theplu::yat::regression::LinearWeighted::beta_var ( void  ) const

Variance is estimated as $ \frac{s^2}{\sum w_i(x_i-m_x)^2} $

See also:
s2()
Returns:
variance of parameter $ \beta $
void theplu::yat::regression::LinearWeighted::fit ( const utility::VectorBase x,
const utility::VectorBase y,
const utility::VectorBase w 
)
virtual

This function computes the best-fit linear regression coefficients $ (\alpha, \beta)$ of the model $ y = \alpha + \beta (x-m_x) $ from vectors x and y, by minimizing $ \sum{w_i(y_i - \alpha - \beta (x-m_x))^2} $, where $ m_x $ is the weighted average. By construction $ \alpha $ and $ \beta $ are independent.

Implements theplu::yat::regression::OneDimensionalWeighted.

double theplu::yat::regression::LinearWeighted::predict ( const double  x) const
virtual

Function predicting value using the linear model: $ y =\alpha + \beta (x - m) $

Implements theplu::yat::regression::OneDimensionalWeighted.

double theplu::yat::regression::OneDimensionalWeighted::prediction_error2 ( const double  x,
const double  w = 1.0 
) const
inherited
  The prediction error is defined as expected squared deviation a
  new data point (with weight @a w) will be from the model
  value \form#211 and is typically
  divided into the conditional variance ( see s2() )
  given \form#62 and the squared standard error ( see
  standard_error2() ) of the model estimation in \form#62.

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

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

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.

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

Noise level for points with weight w.

Implements theplu::yat::regression::OneDimensionalWeighted.

double theplu::yat::regression::LinearWeighted::standard_error2 ( const double  x) const
virtual

estimated error $ y_{err} = \sqrt{ Var(\alpha) + Var(\beta)*(x-m)} $.

Implements theplu::yat::regression::OneDimensionalWeighted.


Member Data Documentation

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

Averager for pair of x and y

double theplu::yat::regression::OneDimensionalWeighted::chisq_
protectedinherited

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 Mon Nov 11 2013 09:41:45 for yat by  doxygen 1.8.1