het_test: LM test for heteroskedasticity

Description Usage Arguments Details Value Examples

View source: R/het_test.R

Description

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

Usage

1
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.

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 χ^2 under the null hypothesis of homoskedasticity.

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.

Examples

1
2
3
4
5
6
7
8
9
data("hprice1")

mod <- lm(price ~ sqrft + bdrms, data = hprice1)

# Test using all regressorn in mod
het_test(mod)

# Using sqrft only
het_test(mod, ~ sqrft)

jcpernias/ec1027 documentation built on Dec. 20, 2021, 10:03 p.m.