SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWLogisticRegressionParam Class Reference

Container class for logistic regression parameter estimates and their associated statistical quantities. More...

#include <rw/analytics/logregparam.h>

Public Member Functions

 RWLogisticRegressionParam ()
 
 RWLogisticRegressionParam (const RWLogisticRegressionParam &rhs)
 
RWInterval< double > confidenceInterval (double alpha) const
 
RWLogisticRegressionParamoperator= (const RWLogisticRegressionParam &rhs)
 
double standardError () const
 
double value () const
 
double waldChiSqStatCriticalValue (double alpha) const
 
double waldChiSqStatistic () const
 
double waldChiSqStatPValue () const
 

Detailed Description

RWLogisticRegressionParam is the container class for logistic regression parameter estimates and their associated statistical quantities. The estimates are described in the Business Analysis Module User's Guide.

Synopsis
#include <rw/analytics/logparam.h>
#include <rw/analytics/logregress.h>
Performs basic logistic regression on a matrix of predictor variables and a vector of observations.
Definition logregress.h:82
RWTValVector< RWLogisticRegressionParam > parameterEstimates() const
A value-based collection of values implemented as a vector.
Definition tvvector.h:103
Example
#include <rw/analytics/logregress.h>
#include <iostream>
int main() {
RWGenMat<double> predData = "5x2
[1 234 2 431 3 333 4 654 5 788] ";
obsData(5, rwUninitialized);
obsData[0] = obsData[3] = obsData[4] = true;
obsData[1] = obsData[2] = false;
RWLogisticRegression lr(predData, obsData);
// Make sure parameter calculation succeeded.
if (lr.fail()) {
return 0;
}
double sigLevel = .05;
// Print out model parameter estimate info.
for (size_t i = 0; i < params.length(); i++) {
std::cout << "Model parameter " << i
<< (i == 0 ? " Intercept:" : ":") << std::endl;
std::cout << " value: " << params[i].value()
<< std::endl;
std::cout << " standard error: "
<< params[i].standardError() << std::endl;
std::cout << " Wald statistic: "
<< params[i].waldChiSqStatistic() << std::endl;
std::cout << " Wald statistic P-value: "
<< params[i].waldChiSqStatPValue() << std::endl;
std::cout << " Wald statistic critical value: "
<< params[i].waldChiSqStatCriticalValue(sigLevel)
<< std::endl;
std::cout << " " << sigLevel << " confidence interval: "
<< "["
<< params[i].confidenceInterval(sigLevel).lowerBound()
<< ", "
<< params[i].confidenceInterval(sigLevel).upperBound()
<< "]" << std::endl;
}
return 0;
}
A templatized general matrix class.
Definition genmat.h:741
A templatized vector class.
Definition mathvec.h:667
bool fail() const
Definition regress.h:302
size_type length() const
Definition tvvector.h:490
@ rwUninitialized
Definition defs.h:105

Constructor & Destructor Documentation

◆ RWLogisticRegressionParam() [1/2]

RWLogisticRegressionParam::RWLogisticRegressionParam ( )
inline

Constructs an empty fitted parameter object. Behavior undefined.

◆ RWLogisticRegressionParam() [2/2]

RWLogisticRegressionParam::RWLogisticRegressionParam ( const RWLogisticRegressionParam & rhs)
inline

Constructs a copy of rhs.

Member Function Documentation

◆ confidenceInterval()

RWInterval< double > RWLogisticRegressionParam::confidenceInterval ( double alpha) const

Returns an alpha level confidence interval for the parameter.

◆ operator=()

RWLogisticRegressionParam & RWLogisticRegressionParam::operator= ( const RWLogisticRegressionParam & rhs)

Assignment operator.

◆ standardError()

double RWLogisticRegressionParam::standardError ( ) const

Returns the estimated standard error for the fitted value. This is the square root of the estimated variance, V, described in the Business Analysis Module User's Guide.

◆ value()

double RWLogisticRegressionParam::value ( ) const
inline

Returns the least squares estimate for the parameter.

◆ waldChiSqStatCriticalValue()

double RWLogisticRegressionParam::waldChiSqStatCriticalValue ( double alpha) const
inline

Returns the critical value for the Wald chi-square statistic at significance level alpha.

◆ waldChiSqStatistic()

double RWLogisticRegressionParam::waldChiSqStatistic ( ) const
inline

Returns the Wald chi-square statistic for the hypothesis that the parameter is equal to 0.

◆ waldChiSqStatPValue()

double RWLogisticRegressionParam::waldChiSqStatPValue ( ) const
inline

Returns the P-value for the parameter Wald chi-square statistic.

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