rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWLinRegressFStatistic Class Reference
[Parameter Calculation]

Function object that takes the data and parameters associated with a linear regression model and returns the F statistic for that model. More...

#include <rw/analytics/ffunc.h>

Inherits RWModelEvalFunctor< double, double >.

List of all members.

Public Member Functions

 RWLinRegressFStatistic ()
virtual double operator() (const RWGenMat< double > &xdata, const RWMathVec< double > &ydata, const RWMathVec< double > &coefficients) const

Detailed Description

Class RWLinRegressFStatistic is a function object that takes the data and parameters associated with a linear regression model and returns the F statistic for that model. An equation for the F statistic can be found in Section 3.2.4, "Significance of the Model (Overall F Statistic)," in the Business Analysis Module User's Guide.

This class is useful in conjunction with the model selection class RWLinRegModelSelector<F>, which requires a function object to evaluate the quality of different predictor variable subsets. However, it can also be used by itself as a direct way of calculating the F statistic.

Synopsis

 #include <rw/analytics/ffunc.h>

 RWLinRegressFStatistic fstat;

Examples

 #include <rw/analytics/linregress.h>
 #include <rw/analytics/ffunc.h>

 int main() {
  RWGenMat<double> predictorMatrix =
                        "5x2 [1.2 2.1 8 7 3 3.2 6.4 4.6 2 2.3]";
  RWMathVec<double> observationVector = "[2.5 3.7 1.4 2.3 5.6]";

  RWLinearRegression lr(predictorMatrix, observationVector);
  RWLinRegressFStatistic fstat;

  // Print the F statistic value if parameter
  // calculation succeeded.
  if ( !lr.fail() )
   cout << "F statistic: " << fstat(lr.regressionMatrix(),
           lr.observationVector(), lr.parameters()) << endl;
  else
   cout << "Parameter calculation failed." << endl;
  return 0;
 }

Constructor & Destructor Documentation

RWLinRegressFStatistic::RWLinRegressFStatistic (  )  [inline]

Constructs an empty evaluation function object. Behavior is undefined.


Member Function Documentation

virtual double RWLinRegressFStatistic::operator() ( const RWGenMat< double > &  xdata,
const RWMathVec< double > &  ydata,
const RWMathVec< double > &  coefficients 
) const [virtual]

Given a regression class instance, this function returns the F statistic associated with the predictor variables selected in the model.

 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.