yat  0.11.3pre
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
theplu::yat::regression::OneDimensional Class Referenceabstract

Interface Class for One Dimensional fitting. More...

#include <yat/regression/OneDimensional.h>

Inheritance diagram for theplu::yat::regression::OneDimensional:
theplu::yat::regression::Linear theplu::yat::regression::Naive theplu::yat::regression::Polynomial

Public Member Functions

 OneDimensional (void)
 The default constructor.
 
virtual ~OneDimensional (void)
 The destructor.
 
double chisq (void) const
 Chi-squared.
 
virtual void fit (const utility::VectorBase &x, const utility::VectorBase &y)=0
 
virtual double predict (const double x) const =0
 
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
 
virtual double s2 (void) const =0
 
virtual double standard_error2 (const double x) const =0
 

Protected Member Functions

double variance (void) const
 

Protected Attributes

statistics::AveragerPair ap_
 
double chisq_
 

Detailed Description

Interface Class for One Dimensional fitting.

See Also
OneDimensionalWeighted.

Member Function Documentation

double theplu::yat::regression::OneDimensional::chisq ( void  ) const

Chi-squared.

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

virtual void theplu::yat::regression::OneDimensional::fit ( const utility::VectorBase x,
const utility::VectorBase y 
)
pure virtual

This function computes the best-fit given a model (see specific class for details) by minimizing $ \sum{(\hat{y_i}-y_i)^2} $, where $ \hat{y} $ is the fitted value.

Implemented in theplu::yat::regression::Linear, theplu::yat::regression::Polynomial, and theplu::yat::regression::Naive.

virtual double theplu::yat::regression::OneDimensional::predict ( const double  x) const
pure virtual
Returns
expected value in x accrding to the fitted model

Implemented in theplu::yat::regression::Linear, theplu::yat::regression::Polynomial, and theplu::yat::regression::Naive.

double theplu::yat::regression::OneDimensional::prediction_error2 ( const double  x) const

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

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
osOstream printout is sent to
nnumber of points printed
minsmallest x-value for which the model is printed
maxlargest x-value for which the model is printed
double theplu::yat::regression::OneDimensional::r2 ( void  ) const

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()
virtual double theplu::yat::regression::OneDimensional::s2 ( void  ) const
pure virtual
virtual double theplu::yat::regression::OneDimensional::standard_error2 ( const double  x) const
pure virtual

The standard error is defined as $ E(Y|x - \hat{y}(x))^2 $

Returns
expected squared error of model value in x

Implemented in theplu::yat::regression::Linear, theplu::yat::regression::Polynomial, and theplu::yat::regression::Naive.

double theplu::yat::regression::OneDimensional::variance ( void  ) const
protected

Variance of y

Member Data Documentation

statistics::AveragerPair theplu::yat::regression::OneDimensional::ap_
protected

Averager for pair of x and y

double theplu::yat::regression::OneDimensional::chisq_
protected
See Also
chisq()

The documentation for this class was generated from the following file:

Generated on Sat May 24 2014 03:33:05 for yat by  doxygen 1.8.2