yat  0.14.5pre
Public Member Functions | Protected Attributes | List of all members
theplu::yat::regression::PolynomialWeighted Class Reference

Polynomial Regression in weighted fashion. More...

#include <yat/regression/PolynomialWeighted.h>

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

Public Member Functions

 PolynomialWeighted (size_t power)
 
 ~PolynomialWeighted (void)
 Destructor.
 
void fit (const utility::VectorBase &x, const utility::VectorBase &y, const utility::VectorBase &w)
 
const utility::Vectorfit_parameters (void) const
 
double s2 (const double w=1) const
 Mean Squared Error.
 
double predict (const double x) 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. More...
 

Detailed Description

Polynomial Regression in weighted fashion.

Constructor & Destructor Documentation

theplu::yat::regression::PolynomialWeighted::PolynomialWeighted ( size_t  power)
Parameters
powerdegree of polynomial model

Member Function Documentation

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

This function computes the best-fit given the polynomial model model 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 $

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

const utility::Vector& theplu::yat::regression::PolynomialWeighted::fit_parameters ( void  ) const
Returns
parameters of the model
See Also
MultiDimensional
double theplu::yat::regression::PolynomialWeighted::predict ( const double  x) const
virtual

function predicting in one point.

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.

double theplu::yat::regression::PolynomialWeighted::standard_error2 ( const double  x) const
virtual
Returns
error of model value in x

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 Tue Sep 26 2017 02:33:30 for yat by  doxygen 1.8.5