zhou_etal {skedastic} | R Documentation |
Zhou, Song, and Thompson's Test for Heteroskedasticity in a Linear Regression Model
Description
This function implements the methods of Zhou et al. (2015) for testing for heteroskedasticity in a linear regression model.
Usage
zhou_etal(
mainlm,
auxdesign = NA,
method = c("pooled", "covariate-specific", "hybrid"),
Bperturbed = 500L,
seed = 1234,
statonly = FALSE
)
Arguments
mainlm |
Either an object of |
auxdesign |
A |
method |
A character specifying which of the three test methods to
implement; one of |
Bperturbed |
An integer specifying the number of perturbation samples
to generate when estimating the |
seed |
An integer specifying a seed to pass to
|
statonly |
A logical. If |
Details
Zhou et al. (2015) The authors propose
three variations based on comparisons between sandwich and model-based
estimators for the variances of individual regression coefficient
esimators. The covariate-specific method computes a test statistic and
p
-value for each column of the auxiliary design matrix (which is,
by default, the original design matrix with intercept omitted). The
p
-values undergo a Bonferroni correction to control overall test
size. When the null hypothesis is rejected in this case, it also provides
information about which auxiliary design variable is associated with the
error variance. The pooled method computes a single test statistic and
p
-value and is thus an omnibus test. The hybrid method returns the
minimum p
-value between the Bonferroni-corrected covariate-specific
p
-values and the pooled p
-value, multiplying it by 2 for a
further Bonferroni correction. The test statistic returned is that
which corresponds to the minimum p
-value. The covariate-specific
and pooled test statistics have null distributions that are
asymptotically normal with mean 0. However, the variance is intractable
and thus perturbation sampling is used to compute p
-values
empirically.
Value
An object of class
"htest". If object is not
assigned, its attributes are displayed in the console as a
tibble
using tidy
.
References
Zhou QM, Song PX, Thompson ME (2015). “Profiling Heteroscedasticity in Linear Regression Models.” The Canadian Journal of Statistics, 43(3), 358–377.
Examples
mtcars_lm <- lm(mpg ~ wt + qsec + am, data = mtcars)
zhou_etal(mtcars_lm, method = "pooled")
zhou_etal(mtcars_lm, method = "covariate-specific")
zhou_etal(mtcars_lm, method = "hybrid")