evans_king {skedastic} | R Documentation |
Evans-King Tests for Heteroskedasticity in a Linear Regression Model
Description
This function implements the two methods of Evans and King (1988) for testing for heteroskedasticity in a linear regression model.
Usage
evans_king(
mainlm,
method = c("GLS", "LM"),
deflator = NA,
lambda_star = 5,
qfmethod = "imhof",
statonly = FALSE
)
Arguments
mainlm |
Either an object of |
method |
A character indicating which of the two tests derived in
Evans and King (1988) should be implemented.
Possible values are |
deflator |
Either a character specifying a column name from the
design matrix of |
lambda_star |
A double; coefficient representing the degree of
heteroskedasticity under the alternative hypothesis.
Evans and King (1985) suggests 2.5, 5, 7.5, and 10 as
values to consider, and Evans and King (1988) finds
that 2.5 and 5 perform best empirically. This parameter is used only for
the |
qfmethod |
A character, either |
statonly |
A logical. If |
Details
The test entails putting the data rows in increasing order of
some specified deflator (e.g., one of the explanatory variables) that
is believed to be related to the error variance by some non-decreasing
function. There are two statistics that can be used, corresponding to
the two values of the method
argument. In both cases the test
statistic can be expressed as a ratio of quadratic forms in the errors,
and thus the Imhof algorithm is used to compute p
-values. Both
methods involve a left-tailed test.
Value
An object of class
"htest"
. If object is
not assigned, its attributes are displayed in the console as a
tibble
using tidy
.
References
Evans M, King ML (1985).
“A Point Optimal Test for Heteroscedastic Disturbances.”
Journal of Econometrics, 27(2), 163–178.
Evans MA, King ML (1988).
“A Further Class of Tests for Heteroscedasticity.”
Journal of Econometrics, 37, 265–276.
See Also
Evans and King (1985), which already anticipates one of the tests.
Examples
mtcars_lm <- lm(mpg ~ wt + qsec + am, data = mtcars)
evans_king(mtcars_lm, deflator = "qsec", method = "GLS")
evans_king(mtcars_lm, deflator = "qsec", method = "LM")