Fit an auxiliary regression of the squared MCO residual on the covariates
specified in frml
.
het_test(model, frml = NULL, chisq = FALSE)
model | an estimated model returned by |
---|---|
frml | an one-sided with the regressors of the auxiliary regression.
If |
chisq | if |
An object of class htest
with components:
the value of the test statistic.
the p-value of the test.
degrees of freedom.
a character string indicating what type of test was performed.
a character string describing the model.
By default, the test is the F statistic of the auxiliary regression. The LM version of the test is the product of the umber of observations and the R-squared and it is distributed as a \(\chi^2\) under the null hypothesis of homoskedasticity.
data("hprice1") mod <- lm(price ~ sqrft + bdrms, data = hprice1) # Test using all regressorn in mod het_test(mod)#> #> LM test for heteroskedasticity #> #> data: Auxiliary regression of squared residuals from: #> lm(price ~ sqrft + bdrms, data = hprice1) #> on all covariates. #> #> #> F = 5.8056, df1 = 2, df2 = 85, p-value = 0.004331 #># Using sqrft only het_test(mod, ~ sqrft)#> #> LM test for heteroskedasticity #> #> data: Auxiliary regression of squared residuals from: #> lm(price ~ sqrft + bdrms, data = hprice1) #> on: ~sqrft. #> #> #> F = 10.621, df1 = 1, df2 = 86, p-value = 0.001602 #>