Gadget
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Regression Class Referenceabstract

This is the base class used to fit a regression line to compare 2 vectors. More...

#include <regressionline.h>

Inheritance diagram for Regression:
Inheritance graph
Collaboration diagram for Regression:
Collaboration graph

Public Member Functions

 Regression ()
 This is the default Regression constructor. More...
 
 Regression (LineType ltype)
 This is the Regression constructor for a regression line of a specified LineType. More...
 
virtual ~Regression ()
 This is the default Regression destructor. More...
 
virtual void storeVectors (const DoubleVector &modData, const DoubleVector &obsData)=0
 This is the function that stores 2 vectors that will be compared using a regression line. More...
 
void calcFit ()
 This is the function that fits a regression line to compare the 2 vectors that have been stored, according to the LineType that has been defined. More...
 
void setIntercept (double intercept)
 This function will set the intercept of the regression line. More...
 
void setSlope (double slope)
 This function will set the slope of the regression line. More...
 
void setWeights (const DoubleVector &weights)
 This function will set the weights that can be used to fit the regression line. More...
 
int getError ()
 This function will check to see if an error has occured. More...
 
double getSSE ()
 This function will return the sum of squares of errors calculated when fitting the regression line. More...
 
double getIntercept ()
 This function will return the intercept of the regression line. More...
 
double getSlope ()
 This function will return the slope of the regression line. More...
 
LineType getType () const
 This function will return the fit type for the regression line. More...
 

Protected Member Functions

void calcSSE ()
 This function will calculate the sum of squares of errors for the regession line. More...
 
void calcSSEWeights ()
 This function will calculate the weighted sum of squares of errors for the regession line. More...
 
void calcSlope ()
 This function will calculate the slope of the regession line. More...
 
void calcIntercept ()
 This function will calculate the intercept of the regession line. More...
 
void calcSlopeIntercept ()
 This function will calculate both the slope and the intercept of the regession line. More...
 

Protected Attributes

int error
 This is the flag to denote whether an error has occured. More...
 
int useweights
 This is the flag to denote whether the weights should be used when calculating the fit to the regression line. More...
 
double sse
 This is the sum of squares of errors from the regression line. More...
 
double a
 This is the intercept of the regression line. More...
 
double b
 This is the slope of the regression line. More...
 
DoubleVector w
 This is the DoubleVector of weights that can be used to fit the regression line. More...
 
DoubleVector x
 This is the DoubleVector that will contain the the modelled data to be used to fit the regression line. More...
 
DoubleVector y
 This is the DoubleVector that will contain the the observed data to be used to fit the regression line. More...
 
LineType linetype
 This denotes what type of line fit is to be used for the regression line. More...
 

Detailed Description

This is the base class used to fit a regression line to compare 2 vectors.

Note
This will always be overridden by the derived classes that actually fit the regression line

Constructor & Destructor Documentation

◆ Regression() [1/2]

Regression::Regression ( )

This is the default Regression constructor.

◆ Regression() [2/2]

Regression::Regression ( LineType  ltype)

This is the Regression constructor for a regression line of a specified LineType.

Parameters
ltypeis the LineType of the regression line

◆ ~Regression()

virtual Regression::~Regression ( )
inlinevirtual

This is the default Regression destructor.

Member Function Documentation

◆ calcFit()

void Regression::calcFit ( )

This is the function that fits a regression line to compare the 2 vectors that have been stored, according to the LineType that has been defined.

◆ calcIntercept()

void Regression::calcIntercept ( )
protected

This function will calculate the intercept of the regession line.

◆ calcSlope()

void Regression::calcSlope ( )
protected

This function will calculate the slope of the regession line.

◆ calcSlopeIntercept()

void Regression::calcSlopeIntercept ( )
protected

This function will calculate both the slope and the intercept of the regession line.

◆ calcSSE()

void Regression::calcSSE ( )
protected

This function will calculate the sum of squares of errors for the regession line.

◆ calcSSEWeights()

void Regression::calcSSEWeights ( )
protected

This function will calculate the weighted sum of squares of errors for the regession line.

◆ getError()

int Regression::getError ( )
inline

This function will check to see if an error has occured.

Returns
error

◆ getIntercept()

double Regression::getIntercept ( )
inline

This function will return the intercept of the regression line.

Returns
a

◆ getSlope()

double Regression::getSlope ( )
inline

This function will return the slope of the regression line.

Returns
b

◆ getSSE()

double Regression::getSSE ( )

This function will return the sum of squares of errors calculated when fitting the regression line.

Returns
sse

◆ getType()

LineType Regression::getType ( ) const
inline

This function will return the fit type for the regression line.

Returns
fittype

◆ setIntercept()

void Regression::setIntercept ( double  intercept)
inline

This function will set the intercept of the regression line.

Parameters
interceptis the intercept of the regression line

◆ setSlope()

void Regression::setSlope ( double  slope)
inline

This function will set the slope of the regression line.

Parameters
slopeis the slope of the regession line

◆ setWeights()

void Regression::setWeights ( const DoubleVector weights)

This function will set the weights that can be used to fit the regression line.

Parameters
weightsis the DoubleVector of weights to be used

◆ storeVectors()

virtual void Regression::storeVectors ( const DoubleVector modData,
const DoubleVector obsData 
)
pure virtual

This is the function that stores 2 vectors that will be compared using a regression line.

Parameters
modDatais the DoubleVector containing the modelled data
obsDatais the DoubleVector containing the observed data

Implemented in LogWeightRegression, WeightRegression, LogLinearRegression, and LinearRegression.

Member Data Documentation

◆ a

double Regression::a
protected

This is the intercept of the regression line.

◆ b

double Regression::b
protected

This is the slope of the regression line.

◆ error

int Regression::error
protected

This is the flag to denote whether an error has occured.

◆ linetype

LineType Regression::linetype
protected

This denotes what type of line fit is to be used for the regression line.

◆ sse

double Regression::sse
protected

This is the sum of squares of errors from the regression line.

◆ useweights

int Regression::useweights
protected

This is the flag to denote whether the weights should be used when calculating the fit to the regression line.

◆ w

DoubleVector Regression::w
protected

This is the DoubleVector of weights that can be used to fit the regression line.

◆ x

DoubleVector Regression::x
protected

This is the DoubleVector that will contain the the modelled data to be used to fit the regression line.

◆ y

DoubleVector Regression::y
protected

This is the DoubleVector that will contain the the observed data to be used to fit the regression line.


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