rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWLeastSqQRPvtCalc Class Reference
[Parameter Calculation]

Calculates linear regression parameters using QR decomposition with pivoting. More...

#include <rw/analytics/lsqqrpvt.h>

Inheritance diagram for RWLeastSqQRPvtCalc:
RWRegressionCalc< double, double >

List of all members.

Public Member Functions

 RWLeastSqQRPvtCalc (double tol=0.0)
virtual void calc (const RWGenMat< double > &, const RWMathVec< double > &)
virtual RWMathVec< double > parameters () const
virtual RWRegressionCalc
< double, double > * 
clone () const
virtual bool fail () const
virtual RWCString name () const
void setTolerance (double tol)
double getTolerance () const

Detailed Description

Class RWLeastSqQRPvtCalc implements the calculation of linear regression parameters using QR decomposition with pivoting, as described in Section 5.5.1.2, "RWLeastSqQRPvtCalc" in the Business Analysis Module User's Guide.

Synopsis

 #include <rw/analytics/lsqqrpvt.h>

 RWLeastSqQRPvtCalc calc;

Examples

 #include <rw/analytics/lsqqrpvt.h>
 #include <rw/rstream.h> // Handles proper inclusion of iostream.

 int main() {
  RWGenMat<double> predictorMatrix =
                        "5x2 [1.2 2.1 8 7 3 3.2 6.4 4.6 2 2.3]";
  RWMathVec<double> observationVector = "[2.5 3.7 1.4 2.3 5.6]";
  RWLeastSqQRPvtCalc qrpvt;

  qrpvt.calc(predictorMatrix, observationVector);

  if ( !qrpvt.fail() )
   cout << "Model parameters: " << qrpvt.parameters() << endl;
  else
   cout << "Parameter calculation failed." << endl;
  return 0;
 }

Constructor & Destructor Documentation

RWLeastSqQRPvtCalc::RWLeastSqQRPvtCalc ( double  tol = 0.0  ) 

Constructs an RWLeastSqQRPvtCalc object with the specified tolerance parameter tol. Entries along the diagonal of the R factor of the QR decompositio less than this tolerance are treated as zero. Using this can prevent insignificant entries of R from corrupting your solution.


Member Function Documentation

virtual void RWLeastSqQRPvtCalc::calc ( const RWGenMat< double > &  ,
const RWMathVec< double > &   
) [virtual]

Calculates the parameters for the regression model. Invoking this method does not affect the state of any existing base calculation.

Implements RWRegressionCalc< double, double >.

virtual RWRegressionCalc<double,double>* RWLeastSqQRPvtCalc::clone (  )  const [inline, virtual]

Allocates and creates a clone, or exact copy, of the current instance, and returns a pointer to the copy. Caller is responsible for deleting the returned object.

Implements RWRegressionCalc< double, double >.

virtual bool RWLeastSqQRPvtCalc::fail (  )  const [inline, virtual]

Returns false.

Implements RWRegressionCalc< double, double >.

double RWLeastSqQRPvtCalc::getTolerance (  )  const [inline]

Gets the tolerance parameter for the QR decomposition. Entries along the diagonal of the R factor of the QR decomposition that are less than this tolerance are treated as zero. Using this can prevent insignificant entries of R from corrupting your solution.

virtual RWCString RWLeastSqQRPvtCalc::name (  )  const [inline, virtual]

Returns the name of the calculation method.

Implements RWRegressionCalc< double, double >.

virtual RWMathVec<double> RWLeastSqQRPvtCalc::parameters (  )  const [inline, virtual]

Returns the parameters from the last calculation performed. If the calculation failed, and this method is called, an exception of type RWInternalErr is thrown.

Implements RWRegressionCalc< double, double >.

void RWLeastSqQRPvtCalc::setTolerance ( double  tol  )  [inline]

Sets the tolerance parameter for the QR decomposition. Entries along the diagonal of the R factor of the QR decomposition that are less than this tolerance are treated as zero. Using this can prevent insignificant entries of R from corrupting your solution.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

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