Fit an auxiliary regression of the squared MCO residual on the covariates specified in frml.

het_test(model, frml = NULL, chisq = FALSE)

Arguments

model

an estimated model returned by lm or similar functions.

frml

an one-sided with the regressors of the auxiliary regression. If NULL all of the model regressors are used in the auxiliary regression.

chisq

if TRUE the LM statistic of the auxiliary regression is returned. By default is FALSE and the F statistic is computed.

Value

An object of class htest with components:

statistic

the value of the test statistic.

p.value

the p-value of the test.

parameter

degrees of freedom.

method

a character string indicating what type of test was performed.

data.name

a character string describing the model.

Details

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.

Examples

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 #>