theplu::yat::regression::Polynomial Class Reference

Polynomial regression. More...

#include <yat/regression/Polynomial.h>

Inheritance diagram for theplu::yat::regression::Polynomial:

theplu::yat::regression::OneDimensional

List of all members.

Public Member Functions

 Polynomial (size_t power)
 ~Polynomial (void)
 Destructor.
const utility::Matrixcovariance (void) const
 covariance of parameters
void fit (const utility::VectorBase &x, const utility::VectorBase &y)
const utility::Vectorfit_parameters (void) const
double predict (const double x) const
double s2 (void) const
double standard_error2 (const double x) const
double chisq (void) const
 Chi-squared.
double prediction_error2 (const double x) const
std::ostream & print (std::ostream &os, const double min, double max, const unsigned int n) const
 print output to ostream os
double r2 (void) const

Protected Member Functions

double variance (void) const

Protected Attributes

statistics::AveragerPair ap_
double chisq_


Detailed Description

Polynomial regression.

Data are modeled as $ y = \alpha + \beta x + \gamma x^2 + ... + \delta x_i^{\textrm{power}} + \epsilon_i $


Constructor & Destructor Documentation

theplu::yat::regression::Polynomial::Polynomial ( size_t  power  )  [explicit]

Parameters:
power degree of polynomial, e.g. 1 for a linear model


Member Function Documentation

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

Fit the model by minimizing the mean squared deviation between model and data.

Implements theplu::yat::regression::OneDimensional.

const utility::Vector& theplu::yat::regression::Polynomial::fit_parameters ( void   )  const

Returns:
parameters of the model
See also:
MultiDimensional

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

Returns:
value in x of model

Implements theplu::yat::regression::OneDimensional.

double theplu::yat::regression::Polynomial::s2 ( void   )  const [virtual]

$ \frac{\sum \epsilon_i^2}{N-\textrm{DF}} $ where DF is number of parameters in model.

Returns:
variance of residuals

Implements theplu::yat::regression::OneDimensional.

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

Returns:
squared error of model value in x

Implements theplu::yat::regression::OneDimensional.

double theplu::yat::regression::OneDimensional::chisq ( void   )  const [inherited]

Chi-squared.

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

double theplu::yat::regression::OneDimensional::prediction_error2 ( const double  x  )  const [inherited]

The prediction error is defined as the expected squared deviation a new data point will have from value the model provides: $ E(Y|x - \hat{y}(x))^2 $ 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 $.

Returns:
expected squared prediction error for a new data point in x

std::ostream& theplu::yat::regression::OneDimensional::print ( std::ostream &  os,
const double  min,
double  max,
const unsigned int  n 
) const [inherited]

print output to ostream os

Printing estimated model to os in the points defined by min, max, and n. The values printed for each point is the x-value, the estimated y-value, and the estimated standard deviation of a new data poiunt will have from the y-value given the x-value (see prediction_error()).

Parameters:
os Ostream printout is sent to
n number of points printed
min smallest x-value for which the model is printed
max largest x-value for which the model is printed

double theplu::yat::regression::OneDimensional::r2 ( void   )  const [inherited]

r2 is defined as $ 1 - \frac{Var(Y|x)}{Var(Y)} $ or the fraction of the variance explained by the regression model.

See also:
s2()

double theplu::yat::regression::OneDimensional::variance ( void   )  const [protected, inherited]

Variance of y


Member Data Documentation

Averager for pair of x and y

double theplu::yat::regression::OneDimensional::chisq_ [protected, inherited]

See also:
chisq()


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