Tests that the estimated parameters in a linear regression model are equal to a hypothesized vector of values.
More...
Class RWLinearRegressionFTest can be used to test that the estimated parameters in a linear regression model are equal to a hypothesized vector of values. For example, it can test the hypothesis that all parameters are equal to 0. To be completely precise, the class tests the hypothesis that the estimated parameters are the solution to some specified system of linear equations. The test is based on the F statistic, described in the section "Multiple Linear Regression," in the Business Analysis Module User's Guide.
- Synopsis
#include <rw/math/genmat.h>
#include <rw/math/mathvec.h>
#include <rw/analytics/linregress.h>
#include <rw/analytics/lrftest.h>
- Example
The following example creates a linear regression object and tests the hypothesis that all parameters are equal to 0 at a confidence level of 99 percent.
#include <rw/analytics/linregress.h>
#include <lrftest.h>
#include <iostream>
int main() {
"5x2 [1.2 2.1 8 7 3 3.2 6.4 4.6 2 2.3]";
std::cout << " f statistic value: " << FTest.FStatisticValue()
<< std::endl;
std::cout << " f statistic P-value: " << FTest.FStatisticPValue()
<< std::endl;
std::cout << " 99% Critical value: " << FTest.criticalValue(0.01)
<< std::endl;
if ( FTest.reject(0.01) )
{
std::cout << "Reject H0 at significance level 0.01" << std::endl;
}
else
{
std::cout << "Fail to reject H0 at significance level 0.01"
<< std::endl;
}
return 0;
}