Class implements robust linear regression. More...

#include <robustRegression.hpp>

Inheritance diagram for julian::RobustRegression:
julian::DeeplyCopyableRegression< RobustRegression > julian::Regression

Public Types

enum  type {
  BISQUARE, CAUCHY, FAIR, HUBER,
  OLS, WELSCH
}
 Robust regression types. More...
 

Public Member Functions

 RobustRegression ()
 constructor More...
 
 RobustRegression (int order, RobustRegression::type t)
 constructor More...
 
void estimate (const std::vector< double > &x, const std::vector< double > &y)
 estimates the parameters basing on provided data More...
 
std::vector< double > getCoefficient () const
 return coefficients of the regression More...
 
double operator() (double) const
 Operator performing calculation. More...
 
- Public Member Functions inherited from julian::DeeplyCopyableRegression< RobustRegression >
virtual Regressionclone () const
 virtual copy constructor More...
 
- Public Member Functions inherited from julian::Regression
 Regression ()
 Constructor. More...
 
virtual ~Regression ()
 Destructor. More...
 

Private Attributes

int order_
 Order of polynomial. More...
 
RobustRegression::type type_
 Type of robust regression. More...
 
std::vector< double > coefs_
 Vector of coefficients. More...
 

Detailed Description

Class implements robust linear regression.

Robust regression is introduced because OLS models are often heavily influenced by the presence of outliers. Generally robust regression is estimated by minimizing the objective function

\[\sum_i \rho(e_i) = \sum_i \rho (y_i - Y(c, x_i))\]

where $e_i = y_i - Y(c, x_i)$ is the residual of the ith data point, and $\rho(e_i)$ is a function that:

1) $\rho(e) \ge 0 $

2) $\rho(0) = 0$

3) $\rho(-e) = \rho(e)$

4) $\rho(e_1) > \rho(e_2) for |e_1| > |e_2|$

When $\rho(e) = e^2$ we obtain OLS estimator. To find the coefficients minimizing the objective function Iteratively Reweighed Least Squares (IRLS) algorithm is used. In this algorithm the problem of minimizing above sum is reduced to standard OLS with weighting, where weights $w(e)$ depends on error term.

Apart from OLS following functions can be used:

  • Tukey's bi-square function

    \[ w(e) = \left\{ \begin{array}{cc} (1 - e^2)^2, & |e| \le 1 \\ 0, & |e| > 1 \end{array}\right.\]

  • Cauchy’s function (aka Lorentzian function)

    \[ w(e) = \frac{1}{1 + e^2}\]

  • fair regression

    \[w(e) = frac{1}{ 1 + |e|}\]

  • OLS

    \[w(e) = 1 \]

  • Welsch function

    \[w(e) = \exp{(-e^2)}\]

Warning
Cauchy's function does not guarantee a unique solution.

For more information see Chapter 15.7 of [4], Robust Regression and Iteratively reweighted least squares

Remarks
Class uses algorithm implemented in GSL

Member Enumeration Documentation

Robust regression types.

Enumerator
BISQUARE 

Tukey's bi-square function.

CAUCHY 

Cauchy’s function.

FAIR 

Fair regression.

HUBER 

Huber loss function.

OLS 

OLS.

WELSCH 

Welsch function.

Constructor & Destructor Documentation

julian::RobustRegression::RobustRegression ( )
inline

constructor

Note
If no arguments are provided, order of polynomial is set to 2 and type is set to OLS.
julian::RobustRegression::RobustRegression ( int  order,
RobustRegression::type  t 
)
inline

constructor

Member Function Documentation

void julian::RobustRegression::estimate ( const std::vector< double > &  x,
const std::vector< double > &  y 
)
virtual

estimates the parameters basing on provided data

Implements julian::Regression.

std::vector< double > julian::RobustRegression::getCoefficient ( ) const
virtual

return coefficients of the regression

The i-th term of vector represents coefficient of $x^i$

Implements julian::Regression.

double julian::RobustRegression::operator() ( double  ) const
virtual

Operator performing calculation.

This operator returns the value for a given regressor.

Implements julian::Regression.

Member Data Documentation

std::vector<double> julian::RobustRegression::coefs_
private

Vector of coefficients.

int julian::RobustRegression::order_
private

Order of polynomial.

RobustRegression::type julian::RobustRegression::type_
private

Type of robust regression.


The documentation for this class was generated from the following files:
  • C:/Unix/home/OEM/jULIAN/src/mathematics/regressions/robustRegression.hpp
  • C:/Unix/home/OEM/jULIAN/src/mathematics/regressions/robustRegression.cpp