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

RWLinRegModelSelector<F>


Does not inherit

Local Index

Members

Non-Members

Synopsis

#include <rw/math/genmat.h>
#include <rw/math/mathvec.h>
#include <rw/analytics/linregress.h>
#include <rw/analytics/lnrmodsel.h>
#include <rw/analytics/ffunc.h>

RWGenMat<double> predictorMatrix;
RWMathVec<double> observationVector;
RWLinearRegression lr(predictorMatrix, observationVector);
RWLinRegModelSelector<RWLinRegressFStatistic>
modelSelector(lr,rwForwardSelection);

Description

Class RWLinRegModelSelector<F> encapsulates four different model selection algorithms for linear regression. The algorithms are forward, backward, stepwise, and exhaustive selection. Refer to Chapter 4, "Model Selection," in the Business Analysis Module User's Guide for more details about model selection and differences between the four algorithms.

The template parameter F determines the model evaluation criterion object used during model selection search. In the synopsis above, the F statistic is used as the model evaluation criterion. You can substitute your own model evaluation object, provided that it defines the operator() method in the same way as the class RWLinRegressFStatistic.

An instance of the class RWLinRegModelSelector<F> is constructed with a linear regression and a choice of model selection algorithm. At any time, the user may change the selection algorithm or the specific linear regression model. The class provides results of model selection search, including the indices of the predictor variables that were selected, the parameter values for the selected indices, and the model evaluation criterion for the selected predictor variables.

To be used as a template parameter for RWLinRegModelSelector, a class F must implement the following interface:

Example

The following example performs forward selection search on a linear regression model, where the model evaluation criterion is the F statistic.

Public Constructors

RWLinRegModelSelector(); 
RWLinRegModelSelector(const RWLinRegModelSelector<F>&);
RWLinRegModelSelector(const RWLinearRegression& reg, 
                      RWSearchMethod s);

Public Member Functions

const RWRegressionCalc<double,double>& 
calcMethod() const;
double 
evalFunctionForSelected() const;
bool 
fail() const;
RWCString 
failMessage() const;
RWSearchMethod 
searchMethod() const;
const RWBitVec& 
selectedParamIndices(RWSearchMethod s);
const RWBitVec& 
selectedParamIndices() const;
const RWMathVec<double>& 
selectedParamValues() const;
void 
setCalcMethod(const RWRegressionCalc<double,double>& c);
void 
setRegression(const RWLinearRegression&);
void 
setSearchMethod(RWSearchMethod s);

Public Member Operator

RWLinRegModelSelector<F>& 
operator=(const RWLinRegModelSelector<F>& ms);

Global Enumeration

enum RWSearchMethod {rwForwardSelection, 
                     rwBackwardSelection,
                     rwStepwiseSelection,
                     rwExhaustiveSelection}


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.