SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.stats.test.regression.linear.heteroskedasticity
Class HarveyGodfrey

java.lang.Object
  extended by com.numericalmethod.suanshu.stats.test.HypothesisTest
      extended by com.numericalmethod.suanshu.stats.test.regression.linear.heteroskedasticity.HarveyGodfrey

public class HarveyGodfrey
extends HypothesisTest

The Harvey-Godfrey test is used to test for heteroskedasticity in a linear regression model. It tests whether the estimated variance of the residuals from a regression are dependent on the values of the independent variables (regressors).

The Harvey-Godfrey test tests for conditional heteroskedasticity. The test statistics is computed by regressing log of squared residuals from the original regression against the original regressors (plus intercept). The test is a chi-squared test: the test statistic distribution is nχ2 with k degrees of freedom.


Field Summary
protected  int n
          number of observations
protected  Residuals residuals
           
 
Fields inherited from class com.numericalmethod.suanshu.stats.test.HypothesisTest
k, N, pValue, testStatistics
 
Constructor Summary
HarveyGodfrey(Residuals residuals)
          Perform the Harvey-Godfrey test to test for heteroskedasticity in a linear regression model.
 
Method Summary
 java.lang.String alternativeHypothesis()
          Get a description of the alternative hypothesis.
protected  OlsRegression auxiliaryOlsRegression(Vector y, Residuals residuals)
          the auxiliary regression
 OlsRegression getAuxiliaryRegression()
           
protected  ChiSquareDistribution getX2()
           
 java.lang.String nullHypothesis()
          Get a description of the null hypothesis.
 double pValue()
          Get the p-value.
 double testStatistics()
          Get the test statistics.
 
Methods inherited from class com.numericalmethod.suanshu.stats.test.HypothesisTest
oneSidedPvalue, rejectNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

residuals

protected final Residuals residuals

n

protected final int n
number of observations

Constructor Detail

HarveyGodfrey

public HarveyGodfrey(Residuals residuals)
Perform the Harvey-Godfrey test to test for heteroskedasticity in a linear regression model.

Parameters:
residuals - the Residuals object from an OLS regression
Method Detail

getAuxiliaryRegression

public OlsRegression getAuxiliaryRegression()

nullHypothesis

public java.lang.String nullHypothesis()
Description copied from class: HypothesisTest
Get a description of the null hypothesis.

Specified by:
nullHypothesis in class HypothesisTest
Returns:
the null hypothesis description
See Also:
Wikipedia: Null hypothesis

alternativeHypothesis

public java.lang.String alternativeHypothesis()
Description copied from class: HypothesisTest
Get a description of the alternative hypothesis.

Specified by:
alternativeHypothesis in class HypothesisTest
Returns:
the alternative hypothesis description
See Also:
Wikipedia: Alternative hypothesis

testStatistics

public double testStatistics()
Description copied from class: HypothesisTest
Get the test statistics.

Overrides:
testStatistics in class HypothesisTest
Returns:
the test statistics
See Also:
Wikipedia: Test statistic

pValue

public double pValue()
Description copied from class: HypothesisTest
Get the p-value.

Overrides:
pValue in class HypothesisTest
Returns:
the p-value
See Also:
Wikipedia: P-value

getX2

protected ChiSquareDistribution getX2()

auxiliaryOlsRegression

protected OlsRegression auxiliaryOlsRegression(Vector y,
                                               Residuals residuals)
the auxiliary regression

Returns:
the auxiliary regression

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.