zhou_etal | R Documentation |
This function implements the methods of \insertCiteZhou15;textualskedastic for testing for heteroskedasticity in a linear regression model.
zhou_etal( mainlm, auxdesign = NA, method = c("pooled", "covariate-specific", "hybrid"), Bperturbed = 500L, seed = 1234, statonly = FALSE )
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 p-value. Defaults to |
seed |
An integer specifying a seed to pass to
|
statonly |
A logical. If |
Zhou15;textualskedastic 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.
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) zhou_etal(mtcars_lm, method = "pooled") zhou_etal(mtcars_lm, method = "covariate-specific") zhou_etal(mtcars_lm, method = "hybrid")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.