SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
Holds information about the addition of predictor variables to a parameter calculation. More...
#include <rw/analytics/regcalc.h>
Public Member Functions | |
RWAddPredictors () | |
RWAddPredictors (const RWAddPredictors< T, S > &a) | |
RWAddPredictors (const RWGenMat< T > &r, const RWMathVec< S > o, size_t numAdded, bool setBaseToLast=false) | |
size_t | numAdded () const |
void | setNumAdded (size_t na) |
Class RWAddPredictors<T,S> holds information about the addition of predictor variables to a parameter calculation object's base calculation. This information must consist of the following:
#include <rw/analytics/regcalc.h> RWAddPredictors<double,double> a;
#include <rw/analytics/lsqqr.h> #include <rw/rstream.h> int main() { // Full model regression matrix. RWGenMat<double> regMat( "6x3 [1 1.3 .54 \ 1 3.5 .65 \ 1 -2.3 .88 \ 1 8.2 .76 \ 1 -4.2 .32 \ 1 2.4 .43]" ); // Reduced model regression matrix. Contains the first two // columns of regMat. RWGenMat<double> reducedRegMat( regMat(RWAll,RWSlice(0,2)) ); RWMathVec<double> observationVec( "[12.3 15.6 22.3 44.1 32.5 65.2]" ); RWLeastSqQRCalc calcObject; // Set the base calculation for the parameter calculation // object to the reduced regression matrix. calcObject.setBaseCalc( reducedRegMat, observationVec ); if ( calcObject.fail() ) { cout << "Parameter calculation for reduced model failed" << endl; return 1; } cout << "Parameters for reduced model:" << calcObject.parameters() << endl; // Add in the predictor data contained in the last column of // the full model regression matrix using the data change // class RWAddPredictors. RWAddPredictors<double,double> dataChange( regMat, observationVec, 1 ); calcObject.addPredToBaseCalc( dataChange ); if ( calcObject.fail() ) { cout << "Parameter calculation for full model failed" << endl; return 1; } cout << "Parameters for full model:" << calcObject.parameters() << endl; return 0; }
RWAddPredictors< T, S >::RWAddPredictors | ( | ) | [inline] |
Default constructor. Constructs an empty RWAddPredictors object.
RWAddPredictors< T, S >::RWAddPredictors | ( | const RWAddPredictors< T, S > & | a | ) | [inline] |
Copy constructor. Constructs a copy of a.
RWAddPredictors< T, S >::RWAddPredictors | ( | const RWGenMat< T > & | r, | |
const RWMathVec< S > | o, | |||
size_t | numAdded, | |||
bool | setBaseToLast = false | |||
) | [inline] |
Constructs an RWAddPredictors object with the given regression matrix and observation vector. It assumes that the matrix r is obtained from the base calculations regression matrix by appending numAdded columns, and that the observation vector o is identical to the base calculations. If setBaseToLast is true
, the base calculations regression matrix is set to r.
size_t RWAddPredictors< T, S >::numAdded | ( | ) | const [inline] |
Returns the number of predictors added.
void RWAddPredictors< T, S >::setNumAdded | ( | size_t | na | ) | [inline] |
Sets the number of predictors added.
© 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.