Updating Parameter Estimates
Parameter calculations are performed automatically when you construct a regression object, and when you modify the data using one of the class methods listed below. The methods below are member functions of the base class RWRegression and are inherited by both RWLinearRegression and RWLogisticRegression. Note that S is the type double for linear regression and the type bool for logistic regression.
 
void addInterceptParameter();
void removeInterceptParameter();
 
void addObservations(const RWGenMat<double>&,const RWMathVec<S>&);
void addObservation(const RWMathVec<double>&, S);
void removeObservations(size_t startAt, size_t numToRemove);
 
void addPredictors(const RWGenMat<double>&);
void addPredictor(const RWMathVec<double>&);
void removePredictors(size_t startAt, size_t numToRemove);
In addition to the methods listed above, the regression classes have methods that provide handles to the underlying data. Although these handle methods may be used to modify that data, they do not perform the parameter calculations automatically. For example, you may change all the values of the third predictor variable in a model as shown in the following example:
 
RWLinearRegresion lr;
RWMathVec<double> newPredictorValues(lr.numObservations(),
rwUninitialized);
.
.
.
// Fill in the predictor values.
.
.
.
lr.predictorMatrix().col(2) = newPredictorValues;
// Must recompute the parameters explicitly...
lr.reCalculateParameters();
.
.
.
Similarly, you may change the value of the observation vector:
 
RWLogisticRegression lr;
RWMathVec<bool> newObservations( lr.numObservations(),
rwUninitialized );
.
.
.
// Fill in the observation vector.
.
.
.
lr.observationVector() = newObservations;
// Must recompute the parameters explicitly...
lr.reCalculateParameters();
.
.
.
When you change data using the handle functions, it is your responsibility to update the parameters with a call to the reCalculateParameters() method.