The parameter calculation classes calculate model parameters from input regression data. They all derive from the abstract base class RWRegressionCalc<T,S>, which is contained in RWRegression<T,S>. As with RWRegression<T,S>, the first template parameter for RWRegressionCalc<T,S> is the type for predictor data and the second template parameter is the type for observation data.
The class hierarchy for the parameter calculation classes is shown in Figure 2.
Normally, users will not deal with the parameter calculation classes directly. Parameter calculation classes are contained within the regression classes RWLinearRegression and RWLogisticRegression, just as the parameter calculation base class is contained within the regression base class.
The parameter calculation classes for linear regression, that may be contained in class RWLinearRegression, are RWLeastSqQRCalc, RWLeastSqQRPvtCalc, and RWLeastSqSVDCalc. The parameter calculation classes for logistic regression, that may be contained in class RWLogisticRegression, are RWLogisticIterLSQ and RWLogisticLevenbergMarquardt. Each regression class object invokes the appropriate methods on the parameter calculation classes when the regression data it maintains is modified.
>The RWRegressionCalc base class lets you derive classes that maintain the notion of a base calculation. Modifications to regression data are built on the base calculation. To understand this concept, let's consider an example.
Suppose that you have calculated the parameters for a linear regression for some regression matrix X and observation vector Y using a QR decomposition technique. Now you want to add a predictor variable to the linear regression model; that is, you want to append a column to the regression matrix X to obtain a new regression matrix X' and recalculate the parameters. In this particular case, since you're performing a QR decomposition of a matrix that proceeds column by column, you can use the QR decomposition results from your original regression matrix X and simply process the added column of predictor values to obtain the QR decomposition for the matrix X'. By processing only the added column, you can achieve a great savings in computational speed.
For this reason, RWRegressionCalc<T,S> provides methods for setting a base calculation and methods for updating parameter values from new regression data. The new data must be obtained from the base calculation either by adding or deleting predictor variables (columns from the regression matrix), or by adding or deleting observations (rows from the regression matrix and their corresponding elements from the observation vector).
Since maintaining a base calculation is optional for derived RWRegressionCalc classes, the methods that update the base calculation must receive the entire updated regression matrix and observation vector, as well as the information indicating how the base calculation data changed to obtain the new data. This information is encapsulated in data change objects. There are four data change classes: RWAddPredictors, RWRemovePredictors, RWAddObservations, and RWRemoveObservations.
>©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.