Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Business Analysis Module User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

5.2 Regression Classes

Here is a simple example of how to perform a multiple linear regression using class RWLinearRegression:

Performing a logistic regression using class RWLogisticRegression is almost identical:

5.2.1 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.

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:

Similarly, you may change the value of the observation vector:

When you change data using the handle functions, it is your responsibility to update the parameters with a call to the reCalculateParameters() method.

5.2.2 Intercept Option

When constructing a regression object, you must specify an intercept option for the model along with the predictor and observation data. The intercept option is an enumeration defined in the base class RWRegression. The enumeration has three possible values:

If the intercept option isn't specified at construction time, it defaults to addIntercept. The intercept parameter may be added or removed from the regression model at any time using the RWLinearRegression and RWLogisticRegression methods addInterceptParameter() and removeInterceptParameter().

The following examples demonstrate each of the intercept options, using linear regression:

Note that in the example above, objects model1 and model2 are identical.



Previous fileTop of DocumentContentsIndex pageNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.