SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches

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

#include <rw/analytics/gpvalfun.h>

Inherits RWGStatisticFunctor.

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;
Calculates the G statistic for a logistic model in comparison to the intercept-only model.
Definition gpvalfun.h:70
Example
#include <rw/analytics/gpvalfun.h>
#include <rw/analytics/lgmodsel.h>
#include <rw/analytics/logregress.h>
#include <rw/rstream.h>
int main() {
RWGenMat<double> predData = "5x2 [1 234 2 431 3 333 4 654 5 788]";
obsData[0] = obsData[3] = obsData[4] = true;
obsData[1] = obsData[2] = false;
RWLogisticRegression lr(predData, obsData);
cout << "Searching using forward selection---------------" << endl;
cout << "selected parameter indices: "
<< selector.selectedParamIndices() << endl;
cout << "model criterion value: " << selector.evalFunctionForSelected()
<< endl;
return 0;
}
A templatized general matrix class.
Definition genmat.h:741
For a logistic regression model, selects a subset of predictor variables that accounts for the variat...
Definition lgmodsel.h:94
Performs basic logistic regression on a matrix of predictor variables and a vector of observations.
Definition logregress.h:82
A templatized vector class.
Definition mathvec.h:667
@ rwForwardSelection
Definition regsel.h:26
@ rwUninitialized
Definition defs.h:105

Constructor & Destructor Documentation

◆ RWGPValueFunctor()

RWGPValueFunctor::RWGPValueFunctor ( )
inline

Constructs an evaluation function object.

Member Function Documentation

◆ operator()()

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.

Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.