carapeto_holt {skedastic} | R Documentation |
Carapeto-Holt Test for Heteroskedasticity in a Linear Regression Model
Description
This function implements the two methods (parametric and nonparametric) of Carapeto and Holt (2003) for testing for heteroskedasticity in a linear regression model.
Usage
carapeto_holt(
mainlm,
deflator = NA,
prop_central = 1/3,
group1prop = 1/2,
qfmethod = "imhof",
alternative = c("greater", "less", "two.sided"),
twosidedmethod = c("doubled", "kulinskaya"),
statonly = FALSE
)
Arguments
mainlm |
Either an object of |
deflator |
Either a character specifying a column name from the
design matrix of |
prop_central |
A double specifying the proportion of central
observations to exclude when comparing the two subsets of observations.
|
group1prop |
A double specifying the proportion of remaining
observations (after excluding central observations) to allocate
to the first group. The default value of |
qfmethod |
A character, either |
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 |
statonly |
A logical. If |
Details
The test is based on the methodology of
Goldfeld and Quandt (1965) but does not require any
auxiliary regression. It entails ordering the observations by some
suspected deflator (one of the explanatory variables) in such a way
that, under the alternative hypothesis, the observations would now
be arranged in decreasing order of error variance. A specified proportion
of the most central observations (under this ordering) is removed,
leaving a subset of lower observations and a subset of upper
observations. The test statistic is then computed as a ratio of quadratic
forms corresponding to the sums of squared residuals of the upper and
lower observations respectively. p
-values are computed by the
Imhof algorithm in pRQF
.
Value
An object of class
"htest"
. If object is
not assigned, its attributes are displayed in the console as a
tibble
using tidy
.
References
Carapeto M, Holt W (2003).
“Testing for Heteroscedasticity in Regression Models.”
Journal of Applied Statistics, 30(1), 13–20.
Goldfeld SM, Quandt RE (1965).
“Some Tests for Homoscedasticity.”
Journal of the American Statistical Association, 60(310), 539–547.
Examples
mtcars_lm <- lm(mpg ~ wt + qsec + am, data = mtcars)
carapeto_holt(mtcars_lm, deflator = "qsec", prop_central = 0.25)
# Same as previous example
mtcars_list <- list("y" = mtcars$mpg, "X" = cbind(1, mtcars$wt, mtcars$qsec, mtcars$am))
carapeto_holt(mtcars_list, deflator = 3, prop_central = 0.25)