Performs basic logistic regression on a matrix of predictor variables and a vector of observations.
More...
|
| RWLogisticRegression () |
|
| RWLogisticRegression (const RWLogisticRegression &rhs) |
|
| RWLogisticRegression (const RWGenMat< double > predictorData, const RWMathVec< bool > obsVector, InterceptOption interceptOpt=addIntercept) |
|
| RWLogisticRegression (const RWGenMat< double > predictorData, const RWMathVec< bool > obsVector, const RWRegressionCalc< double, bool > &calcObject, InterceptOption interceptOpt=addIntercept) |
|
RWLogisticRegression & | operator= (const RWLogisticRegression &rhs) |
|
RWGenMat< double > | paramDispersionMatrix () const |
|
RWTValVector< RWLogisticRegressionParam > | parameterEstimates () const |
|
RWMathVec< double > | predictedProbSuccess () const |
|
RWMathVec< double > | predictedProbSuccess (const RWGenMat< double > &m) const |
|
double | predictedProbSuccess (const RWMathVec< double > &v) const |
|
RWMathVec< double > | residuals () const |
|
RWMathVec< double > | variance () const |
|
void | addInterceptParameter () |
|
void | addObservation (const RWMathVec< double > &, bool) |
|
void | addObservations (const RWGenMat< double > &, const RWMathVec< bool > &) |
|
void | addPredictor (const RWMathVec< double > &) |
|
void | addPredictors (const RWGenMat< double > &) |
|
const RWRegressionCalc< double, bool > & | calcMethod () const |
|
bool | fail () const |
|
bool | hasInterceptParameter () const |
|
size_t | numObservations () const |
|
size_t | numParameters () const |
|
size_t | numPredictors () const |
|
const RWMathVec< bool > | observationVector () const |
|
RWMathVec< bool > | observationVector () |
|
const RWMathVec< double > | parameters () const |
|
const RWGenMat< double > | predictorMatrix () const |
|
RWGenMat< double > | predictorMatrix () |
|
void | reCalculateParameters () |
|
const RWGenMat< double > | regressionMatrix () const |
|
void | removeInterceptParameter () |
|
void | removeObservations (size_t startingIndex, size_t numToRemove) |
|
void | removePredictors (size_t startingIndex, size_t numToRemove) |
|
void | setCalcMethod (const RWRegressionCalc< double, bool > &c, bool recalculate=true) |
|
void | setRegressionData (const RWGenMat< double > &r, const RWMathVec< bool > &o, InterceptOption interceptOpt=addIntercept) |
|
RWLogisticRegression is the class for performing basic logistic regression, described in the Business Analysis Module User's Guide. RWLogisticRegression receives data input in the form of a matrix of values for the predictor variables, and a vector of values for the observations. In addition, an intercept option must be specified. The interception option is an enumeration type defined in the RWRegression class. It can have three possible values:
- intercept - The regression model contains an intercept parameter, and the input matrix of predictor variable values contains a leading column of 1s corresponding to the intercept parameter.
- noIntercept - The regression model does not contain an intercept parameter.
- addIntercept - The regression model has an intercept parameter, but it is not represented in the input predictor data matrix as a leading column of 1s. In this case, the RWLogisticRegression class prepends a column of 1s to the input predictor data matrix to obtain the full regression matrix.
For a more detailed discussion of the intercept option, see the Business Analysis Module User's Guide.
- Synopsis
#include <rw/analytics/logregress.h>
- Example
#include <rw/analytics/logregress.h>
#include <iostream>
int main()
{
[1 234 2 431 3 333 4 654 5 788]";
obsData[0] = obsData[3] = obsData[4] = true;
obsData[1] = obsData[2] = false;
if ( model.fail() )
{
std::cout << "Parameter calculation failed" << std::endl;
}
else
{
std::cout << "Model parameters: " << model.parameters()
<< std::endl;
}
return 0;
}