#include <yat/regression/NaiveWeighted.h>
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. |
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 from vectors x and y, by minimizing . The weight is proportional to the inverse of the variance for
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] |
Rescaling all weights, both in fit and the passed w, results in the same returned value.
Implements theplu::yat::regression::OneDimensionalWeighted.
double theplu::yat::regression::NaiveWeighted::standard_error2 | ( | const double | x | ) | const [virtual] |
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 and is typically divided into the conditional variance ( see s2() ) given and the squared standard error ( see standard_error2() ) of the model estimation in .
double theplu::yat::regression::OneDimensionalWeighted::r2 | ( | void | ) | const [inherited] |
r2 is defined as or the fraction of the variance explained by the regression model.
statistics::AveragerPairWeighted theplu::yat::regression::OneDimensionalWeighted::ap_ [protected, inherited] |
Averager for pair of x and y
double theplu::yat::regression::OneDimensionalWeighted::chisq_ [protected, inherited] |
Chi-squared.
Chi-squared is defined as the