The Base Calculation
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.