honda | R Documentation |
This function implements the two-sided LM Test of \insertCiteHonda89;textualskedastic for testing for heteroskedasticity in a linear regression model.
honda( mainlm, deflator = NA, alternative = c("two.sided", "greater", "less"), twosidedmethod = c("doubled", "kulinskaya"), qfmethod = "imhof", statonly = FALSE )
mainlm |
Either an object of |
deflator |
Either a character specifying a column name from the
design matrix of |
alternative |
A character specifying the form of alternative
hypothesis. If it is suspected that the error variance is positively
associated with the deflator variable, |
twosidedmethod |
A character indicating the method to be used to compute
two-sided p-values for the parametric test when |
qfmethod |
A character, either |
statonly |
A logical. If |
The test assumes that heteroskedasticity, if present, would be either of the form ω_i = ω(1+θ z_i) or of the form ω_i = ω e^{θ z_i}, where where z_i is a deflator (a nonstochastic variable suspected of being related to the error variance), ω is some unknown constant, and θ is an unknown parameter representing the degree of heteroskedasticity. Since the test statistic Q=\frac{e' A_0 e}{e'e} is a ratio of quadratic forms in the errors, the Imhof algorithm is used to compute p-values. Since the null distribution is in general asymmetrical, the two-sided p-value is computed using the conditional method of \insertCiteKulinskaya08;textualskedastic, setting A=1.
An object of class
"htest"
. If object is
not assigned, its attributes are displayed in the console as a
tibble
using tidy
.
mtcars_lm <- lm(mpg ~ wt + qsec + am, data = mtcars) # In this example, only the test statistic is returned, to save time honda(mtcars_lm, deflator = "qsec", statonly = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.