Regression Classes
The Business Analysis Module contains classes for multiple linear regression and for logistic regression. Both kinds of classes operate on similar input data. The data are in the form of a matrix of values for the predictor variables, and a vector of values for the observation variable.
The base class RWRegression<T,S> encapsulates the mechanics of adding or deleting predictors or observations and updating the parameter estimates. In class RWRegression<T,S>, template parameter T is the numeric type for predictor data, which is a double for both multiple linear and logistic regression. Template parameter S is the numeric type for the observation variable, which is a double for multiple linear regression and an bool for logistic regression.
Class RWRegression<T,S> contains an RWRegressionCalc<T,S> object that it uses to perform parameter calculation. The calculation object may be set at the time of construction or through the setCalcMethod() member function.
The class for performing multiple linear regression, RWLinearRegression, is derived from RWRegression<double,double>. Similarly, the class for performing logistic regression, RWLogisticRegression, is derived from RWRegression<double,bool>. Each of the derived classes adds methods for the particular type of regression being performed. The class hierarchy is shown in Figure 1.
Figure 1 – Regression class inheritance hierarchy