evans_king | R Documentation |
This function implements the two methods of \insertCiteEvans88;textualskedastic for testing for heteroskedasticity in a linear regression model.
evans_king(
mainlm,
method = c("GLS", "LM"),
deflator = NA,
lambda_star = 5,
qfmethod = "imhof",
statonly = FALSE
)
mainlm |
Either an object of |
method |
A character indicating which of the two tests derived in
\insertCiteEvans88;textualskedastic 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.
\insertCiteEvans85;textualskedastic suggests 2.5, 5, 7.5, and 10 as
values to consider, and \insertCiteEvans88;textualskedastic finds
that 2.5 and 5 perform best empirically. This parameter is used only for
the |
qfmethod |
A character, either |
statonly |
A logical. If |
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.
An object of class
"htest"
. If object is
not assigned, its attributes are displayed in the console as a
tibble
using tidy
.
Evans85;textualskedastic, which already anticipates one of the tests.
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.