anscombe: Anscombe's Test for Heteroskedasticity in a Linear Regression...

View source: R/anscombe.R

anscombeR Documentation

Anscombe's Test for Heteroskedasticity in a Linear Regression Model

Description

This function implements the method of \insertCiteAnscombe61;textualskedastic for testing for heteroskedasticity in a linear regression model, with or without the studentising modification of \insertCiteBickel78;textualskedastic.

Usage

anscombe(mainlm, studentise = TRUE, statonly = FALSE)

Arguments

mainlm

Either an object of class "lm" (e.g., generated by lm), or a list of two objects: a response vector and a design matrix. The objects are assumed to be in that order, unless they are given the names "X" and "y" to distinguish them. The design matrix passed in a list must begin with a column of ones if an intercept is to be included in the linear model. The design matrix passed in a list should not contain factors, as all columns are treated 'as is'. For tests that use ordinary least squares residuals, one can also pass a vector of residuals in the list, which should either be the third object or be named "e".

studentise

A logical. Should studentising modification of \insertCiteBickel78;textualskedastic be implemented? Defaults to TRUE; if FALSE, the original form of the test proposed by \insertCiteAnscombe61;textualskedastic is used.

statonly

A logical. If TRUE, only the test statistic value is returned, instead of an object of class "htest". Defaults to FALSE.

Details

Anscombe's Test is among the earliest suggestions for heteroskedasticity diagnostics in the linear regression model. The test is not based on formally derived theory but on a test statistic that Anscombe intuited to be approximately standard normal under the null hypothesis of homoskedasticity. \insertCiteBickel78;textualskedastic discusses the test and suggests a studentising modification (included in this function) as well as a robustifying modification (included in bickel). The test is two-tailed.

Value

An object of class "htest". If object is not assigned, its attributes are displayed in the console as a tibble using tidy.

References

\insertAllCited

See Also

bickel, which is a robust extension of this test.

Examples

mtcars_lm <- lm(mpg ~ wt + qsec + am, data = mtcars)
anscombe(mtcars_lm)


skedastic documentation built on May 29, 2024, 12:20 p.m.