theplu::yat::regression::NaiveWeighted Class Reference

naive fitting. More...

#include <yat/regression/NaiveWeighted.h>

Inheritance diagram for theplu::yat::regression::NaiveWeighted:

theplu::yat::regression::OneDimensionalWeighted

List of all members.

Public Member Functions

 NaiveWeighted (void)
 The default constructor.
virtual ~NaiveWeighted (void)
 The destructor.
void fit (const utility::VectorBase &x, const utility::VectorBase &y, const utility::VectorBase &w)
double predict (const double x) const
double s2 (const 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

naive fitting.


Member Function Documentation

void theplu::yat::regression::NaiveWeighted::fit ( const utility::VectorBase x,
const utility::VectorBase y,
const utility::VectorBase w 
) [virtual]

This function computes the best-fit for the naive model $ y = m $ from vectors x and y, by minimizing $ \sum w_i(y_i-m)^2 $. The weight $ w_i $ is proportional to the inverse of the variance for $ y_i $

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

double theplu::yat::regression::NaiveWeighted::predict ( const double  x  )  const [virtual]

Function predicting value using the naive model, i.e. a weighted average.

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

double theplu::yat::regression::NaiveWeighted::s2 ( const double  w = 1  )  const [virtual]

$ \frac{\sum w_i\epsilon_i^2}{ w \left(\frac{\left(\sum w_i\right)^2}{\sum w_i^2}-1\right)} $

Rescaling all weights, both in fit and the passed w, results in the same returned value.

Returns:
Conditional variance of Y with weight w.

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

double theplu::yat::regression::NaiveWeighted::standard_error2 ( const double  x  )  const [virtual]

$ \frac{\sum w_i\epsilon_i^2}{ \left(\frac{\left(\sum w_i\right)^2}{\sum w_i^2}-1\right)\sum w_i} $

Returns:
estimated squared error of model value in x

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 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 [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.


Member Data Documentation

Averager for pair of x and y

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 Tue Jan 18 02:21:18 2011 for yat by  doxygen 1.5.5