Skip to content

Perform Harvey test for multiplicative heteroscedasticity

Source: man/performHarveyTest.Rd · Help: ?performHarveyTest

Harvey's (1976) Lagrange multiplier test, which regresses log(residuals^2) on a set of variance regressors.

Usage

performHarveyTest(model, data = NULL, auxiliary = c("regressors", "fitted"),
                  studentize = FALSE)

Arguments

model
an object of class lm.
data
optional data frame the model was fitted to. When NULL, the default, the model frame of model is used. The statistic is computed from the residuals, fitted values and model matrix of model, so data does not change the result; it is accepted so that every test takes (model, data, ...). Before 0.15.0 the second argument was auxiliary and the third studentize: a string passed second by position, and a logical value after it, are still read as those two, with a warning that shows the new call; that form stops working in 1.0.0.
auxiliary
character scalar choosing the variance regressors. "regressors" (the default) uses the model's own explanatory variables, the specification in Harvey (1976). "fitted" uses the fitted values and their square, which was the behaviour of releases before 0.7.0.
studentize
logical; if FALSE (the default) the chi-square statistic \(\mathrm{ESS} / (\pi^2 / 2)\) is reported, otherwise the auxiliary regression F statistic.

Value

An object of class htest containing the test statistic, its degrees of freedom and the p-value.

Details

Harvey (1976) models the error variance as \(\sigma_i^2 = \exp(z_i^\top \gamma)\) and tests \(\gamma = 0\) through the auxiliary regression of \(\log \hat{e}_i^2\) on \(z_i\). Under the null the auxiliary error behaves like a centred \(\log \chi^2_1\) variate with variance \(\pi^2 / 2 \approx 4.9348\), so the classical statistic is \(\mathrm{ESS} / (\pi^2 / 2)\), asymptotically chi-square with \(q\) degrees of freedom.

Setting studentize = TRUE replaces the fixed constant \(\pi^2 / 2\) with the auxiliary residual mean square and refers the overall F statistic to an F distribution. The two forms are asymptotically equivalent under normal errors; the studentized form is more reliable when normality is doubtful, because \(\pi^2 / 2\) is the null variance of \(\log \hat{e}^2\) only for Gaussian errors.

Degrees of freedom are taken from the realised rank of the auxiliary design, so a rank-deficient variance model is not credited with degrees of freedom for aliased columns.

Validation

The default statistic reproduces an independent reconstruction of Harvey (1976) to within 1e-8; see tests/testthat/test-pass-a-reference.R. Simulated size and power are recorded in inst/validation/pass-a-size-power.csv.

References

Harvey, A. C. (1976). Estimating regression models with multiplicative heteroscedasticity. Econometrica, 44(3), 461–465. doi:10.2307/1913974

Greene, W. H. (2018). Econometric Analysis (8th ed.). Pearson. Section 9.5 derives the \(\mathrm{ESS} / 4.9348\) form of the statistic.

See also

performParkTest, performGlejserTest, performBPTest

Examples

 data(mtcars)
 m <- lm(mpg ~ wt + qsec, data = mtcars)
 performHarveyTest(m)

 # Studentized variant, which does not assume normal errors
 performHarveyTest(m, studentize = TRUE)

 # Variance driven by the conditional mean rather than by the regressors
 performHarveyTest(m, auxiliary = "fitted")