julian::RegressionWithoutIntercept Class Reference

Class implements simple linear regression without intercept. More...

#include <regressionWithoutIntercept.hpp>

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

Public Member Functions

void estimate (const std::vector< double > &x, const std::vector< double > &y)
 estimates the slope parameters (intercept = 0) basing on provided data More...
 
void estimate (const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &w)
 estimates the slope parameters (intercept = 0) basing on provided data and weights More...
 
std::vector< double > getCoefficient () const
 return coefficients of the regression More...
 
double operator() (double) const
 evaluates the linear regression model for x More...
 
- Public Member Functions inherited from julian::DeeplyCopyableRegression< RegressionWithoutIntercept >
virtual Regressionclone () const
 virtual copy constructor More...
 
- Public Member Functions inherited from julian::Regression
 Regression ()
 Constructor. More...
 
virtual ~Regression ()
 Destructor. More...
 

Private Attributes

double chi_sq_
 The sum of squares of the residuals from the best-fit line. More...
 
double cov00_
 Variance of the slope estimate. More...
 
double cov01_
 Covariance of the slope/intercept estimates. More...
 
double cov11_
 Variance of the intercept estimate. More...
 
double c1_
 Slope of linear regression. More...
 

Friends

std::ostream & operator<< (std::ostream &s, julian::RegressionWithoutIntercept &r)
 Overloads stream operator. More...
 

Detailed Description

Class implements simple linear regression without intercept.

Simple linear regression is a linear regression model with a single explanatory variable without intercept. The parameters of the regression are calculated by minimizing the OLS. In other words class computes the best-fit linear regression coefficients $(c_0)$ of the model $Y = c_1 X$ for the dataset (x, y) by minimizing the sum: $\sum^{n}_{i=1} (Y_i - (c_1 X ))^2 $

For more information see Wikipedia

Remarks
Class uses algorithm implemented in GSL

Member Function Documentation

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

estimates the slope parameters (intercept = 0) basing on provided data

Implements julian::Regression.

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

estimates the slope parameters (intercept = 0) basing on provided data and weights

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

return coefficients of the regression

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

Implements julian::Regression.

double julian::RegressionWithoutIntercept::operator() ( double  x) const
virtual

evaluates the linear regression model for x

Implements julian::Regression.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
julian::RegressionWithoutIntercept r 
)
friend

Overloads stream operator.

This overloaded operator enables to print the curve on the console.

Member Data Documentation

double julian::RegressionWithoutIntercept::c1_
private

Slope of linear regression.

double julian::RegressionWithoutIntercept::chi_sq_
private

The sum of squares of the residuals from the best-fit line.

double julian::RegressionWithoutIntercept::cov00_
private

Variance of the slope estimate.

double julian::RegressionWithoutIntercept::cov01_
private

Covariance of the slope/intercept estimates.

double julian::RegressionWithoutIntercept::cov11_
private

Variance of the intercept estimate.


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