rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWLogisticIterLSQ Class Reference
[Parameter Calculation]

Calculates model parameter estimates from logistic regression data using the iterative least squares method. More...

#include <rw/analytics/loglsq.h>

Inheritance diagram for RWLogisticIterLSQ:
RWRegressionCalc< double, bool >

List of all members.

Public Member Functions

 RWLogisticIterLSQ ()
 RWLogisticIterLSQ (const RWLogisticIterLSQ &nr)
virtual void calc (const RWGenMat< double > &predictors, const RWMathVec< bool > &observations)
virtual void setBaseCalc (const RWGenMat< double > &r, const RWMathVec< bool > &o)
virtual void addPredToBaseCalc (const RWAddPredictors< double, bool > &dataChange)
virtual void removePredFromBaseCalc (const RWRemovePredictors< double, bool > &dataChange)
virtual void addObsToBaseCalc (const RWAddObservations< double, bool > &dataChange)
virtual void removeObsFromBaseCalc (const RWRemoveObservations< double, bool > &dataChange)
virtual RWMathVec< double > parameters () const
virtual bool fail () const
virtual RWCString name () const
virtual RWRegressionCalc
< double, bool > * 
clone () const
RWLogisticIterLSQoperator= (const RWLogisticIterLSQ &)

Detailed Description

Class RWLogisticIterLSQ calculates model parameter estimates from logistic regression data using the iterative least squares method described in the Business Analysis Module User's Guide.

Synopsis

 #include <rw/analytics/loglsq.h>

 RWLogisticIterLSQ c;

Examples

 #include <rw/analytics/loglsq.h>
 #include <iostream>

 int main()
 {
   RWGenMat<double> predData = "5x2 [1 234 2 431 3
                                    333 4 654 5 788]";
   RWMathVec<bool> obsData(5, rwUninitialized );
   obsData[0] = obsData[3] = obsData[4] = true;
   obsData[1] = obsData[2] = false;

   RWLogisticIterLSQ iterativeLSQCalc;
   iterativeLSQCalc.calc( predData, obsData );
   if ( !iterativeLSQCalc.fail() )
   {
     std::cout << "Parameters: " << iterativeLSQCalc.parameters()
               << std::endl;
   }
   else
   {
     std::cout << "Calculation failed" << std::endl;
   }

   return 0;
 }

Constructor & Destructor Documentation

RWLogisticIterLSQ::RWLogisticIterLSQ (  )  [inline]

Constructs an empty RWLogisticIterLSq object.

RWLogisticIterLSQ::RWLogisticIterLSQ ( const RWLogisticIterLSQ nr  )  [inline]

Copy constructor.


Member Function Documentation

virtual void RWLogisticIterLSQ::addObsToBaseCalc ( const RWAddObservations< double, bool > &  dataChange  )  [inline, virtual]

Recalculates the regression model using an additional set of predictor-observation data pairs. This method offers the option of using results from the base calculation to calculate the coefficients for the larger data set. Consequently, this method can be called only when a base calculation has been set using setBaseCalc(). The input variable provides the additional data.

Reimplemented from RWRegressionCalc< double, bool >.

virtual void RWLogisticIterLSQ::addPredToBaseCalc ( const RWAddPredictors< double, bool > &  dataChange  )  [virtual]

Expands the regression model to include new predictor variables. This method offers the option of using results from the base calculation to calculate the coefficients for the larger predictor set. Consequently, this method can be called only when a base calculation has been set using setBaseCalc(). The input variable contains the data for the added predictor variables.

Reimplemented from RWRegressionCalc< double, bool >.

virtual void RWLogisticIterLSQ::calc ( const RWGenMat< double > &  predictors,
const RWMathVec< bool > &  observations 
) [virtual]

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

Implements RWRegressionCalc< double, bool >.

virtual RWRegressionCalc<double,bool>* RWLogisticIterLSQ::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, bool >.

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

Returns true if the calculation failed.

Implements RWRegressionCalc< double, bool >.

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

Returns the name of the calculation method.

Implements RWRegressionCalc< double, bool >.

RWLogisticIterLSQ& RWLogisticIterLSQ::operator= ( const RWLogisticIterLSQ  ) 

Assignment operator.

virtual RWMathVec<double> RWLogisticIterLSQ::parameters (  )  const [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, bool >.

virtual void RWLogisticIterLSQ::removeObsFromBaseCalc ( const RWRemoveObservations< double, bool > &  dataChange  )  [inline, virtual]

Modifies the regression model by removing a set of contiguous predictor-observation data pairs, and recalculating the parameters. This method offers the option of using results from the base calculation to calculate the coefficients for the smaller data set. Consequently, this method can be called only when a base calculation has been set using setBaseCalc(). The input variable indicates the indices of the rows to be removed from the regression matrix and from the observation vector used in the base calculation.

Reimplemented from RWRegressionCalc< double, bool >.

virtual void RWLogisticIterLSQ::removePredFromBaseCalc ( const RWRemovePredictors< double, bool > &  dataChange  )  [virtual]

Shrinks the regression model to exclude previously used predictor variables. This method offers the option of using results from the base calculation to calculate the coefficients for the smaller predictor set. Consequently, this method can be called only when a base calculation has been set using setBaseCalc(). The input variable indicates the indices of the columns to be removed from the regression matrix used in the base calculation.

Reimplemented from RWRegressionCalc< double, bool >.

virtual void RWLogisticIterLSQ::setBaseCalc ( const RWGenMat< double > &  r,
const RWMathVec< bool > &  o 
) [virtual]

Calculates the coefficients for the input regression data and sets the base calculation to this calculation.

Reimplemented from RWRegressionCalc< double, bool >.

 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.