Class Heteroskedasticity
- java.lang.Object
-
- dev.nm.stat.test.HypothesisTest
-
- dev.nm.stat.test.regression.linear.heteroskedasticity.Heteroskedasticity
-
- Direct Known Subclasses:
BreuschPagan,Glejser,HarveyGodfrey,White
public abstract class Heteroskedasticity extends HypothesisTest
A heteroskedasticity test tests, for a linear regression model, whether the estimated variance of the residuals from a regression is dependent on the values of the independent variables (regressors). The test statistic is computed by regressing the transformed residuals from the original regression against the original regressors (plus intercept). Different implementations of heteroskedasticity tests have different ways to do the transformation. The test distribution is a Chi-squared distribution.
-
-
Field Summary
Fields Modifier and Type Field Description protected intNthe number of observationsprotected LMResidualsresiduals
-
Constructor Summary
Constructors Constructor Description Heteroskedasticity(LMResiduals residuals)Construct a heteroskedasticity test.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description StringgetAlternativeHypothesis()Get the description of the alternative hypothesis.protected OLSRegressiongetAuxiliaryOLSRegression(Vector y, LMResiduals residuals)Get the auxiliary regression.protected abstract OLSRegressiongetAuxiliaryRegression()Define the transformation of residuals.StringgetNullHypothesis()Get a description of the null hypothesis.protected ChiSquareDistributiongetX2()Get the Chi-squared distribution.doublepValue()Get the p-value for the test statistics.doublestatistics()Get the test statistics.-
Methods inherited from class dev.nm.stat.test.HypothesisTest
isNullRejected, nGroups, nObs, oneSidedPvalue
-
-
-
-
Field Detail
-
N
protected final int N
the number of observations
-
residuals
protected final LMResiduals residuals
-
-
Constructor Detail
-
Heteroskedasticity
public Heteroskedasticity(LMResiduals residuals)
Construct a heteroskedasticity test.- Parameters:
residuals- the residuals from a linear regression result
-
-
Method Detail
-
getAuxiliaryRegression
protected abstract OLSRegression getAuxiliaryRegression()
Define the transformation of residuals.- Returns:
- an auxiliary regression
-
getNullHypothesis
public String getNullHypothesis()
Description copied from class:HypothesisTestGet a description of the null hypothesis.- Specified by:
getNullHypothesisin classHypothesisTest- Returns:
- the null hypothesis description
- See Also:
- Wikipedia: Null hypothesis
-
getAlternativeHypothesis
public String getAlternativeHypothesis()
Description copied from class:HypothesisTestGet the description of the alternative hypothesis.- Specified by:
getAlternativeHypothesisin classHypothesisTest- Returns:
- the alternative hypothesis description
- See Also:
- Wikipedia: Alternative hypothesis
-
statistics
public double statistics()
Description copied from class:HypothesisTestGet the test statistics.- Specified by:
statisticsin classHypothesisTest- Returns:
- the test statistics
- See Also:
- Wikipedia: Test statistic
-
pValue
public double pValue()
Description copied from class:HypothesisTestGet the p-value for the test statistics.- Specified by:
pValuein classHypothesisTest- Returns:
- the p-value
- See Also:
- Wikipedia: P-value
-
getX2
protected ChiSquareDistribution getX2()
Get the Chi-squared distribution.- Returns:
- the Chi-squared distribution
-
getAuxiliaryOLSRegression
protected OLSRegression getAuxiliaryOLSRegression(Vector y, LMResiduals residuals)
Get the auxiliary regression.- Parameters:
y- the observationsresiduals- the residuals from a linear regression result- Returns:
- the auxiliary regression
-
-