rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWGPValueFunctor Class Reference
[Parameter Calculation]

Calculates the G statistic for a logistic model in comparison to the intercept-only model. More...

#include <rw/analytics/gpvalfun.h>

Inherits RWGStatisticFunctor.

List of all members.

Public Member Functions

 RWGPValueFunctor ()
virtual double operator() (const RWGenMat< double > &predictorData, const RWMathVec< bool > &obsData, const RWMathVec< double > &calc) const

Detailed Description

Class RWGPValueFunctor calculates the G statistic for a logistic model in comparison to the intercept only model. This value has approximately a chi-squared distribution with p degrees of freedom, where p is the number of predictor variables. The P-value of the G statistic is returned.

This class may be used as the template parameter for the class RWLogRegModelSelector.

Synopsis

 #include <rw/analytics/gpvalfun.h>
 RWGPValueFunctor GstatPValue;

Examples

 #include <rw/analytics/lgmodsel.h>
 #include <rw/analytics/logregress.h>
 #include <rw/analytics/gpvalfun.h>
 #include <rw/rstream.h>
 
 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;
 
   RWLogisticRegression lr(predData, obsData);
   RWLogRegModelSelector<RWGPValueFunctor> selector( lr,
                                           rwForwardSelection );
 
   cout << "Searching using forward selection---------------" <<
           endl;
   cout << "selected parameter indices: " <<
           selector.selectedParamIndices() << endl;
   cout << "model criterion value: " <<
           selector.evalFunctionForSelected() << endl;
 
   return 0;
 }

Constructor & Destructor Documentation

RWGPValueFunctor::RWGPValueFunctor (  )  [inline]

Constructs an evaluation function object.


Member Function Documentation

virtual double RWGPValueFunctor::operator() ( const RWGenMat< double > &  predictorData,
const RWMathVec< bool > &  obsData,
const RWMathVec< double > &  calc 
) const [virtual]

Given regression data, computes the G statistic by comparing the p predictor variables in the model with the intercept only model. It returns the P-value of this statistic according to a chi-squared distribution with p degrees of freedom.

 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.