yuce {skedastic}R Documentation

Yüce's Test for Heteroskedasticity in a Linear Regression Model

Description

This function implements the two methods of Yüce (2008) for testing for heteroskedasticity in a linear regression model.

Usage

yuce(mainlm, method = c("A", "B"), 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".

method

A character indicating which of the two tests presented in Yüce (2008) should be implemented. Possible values are "A" (the chi-squared test) and "B" (the t-test). Partial matching is used and the argument is not case-sensitive.

statonly

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

Details

These two tests are straightforward to implement; in both cases the test statistic is a function only of the residuals of the linear regression model. The first test statistic has an asymptotic chi-squared distribution and the second has an asymptotic t-distribution. In both cases the degrees of freedom are n-p. The chi-squared test is right-tailed whereas the t-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

Yüce M (2008). “An Asymptotic Test for the Detection of Heteroskedasticity.” Istanbul University Econometrics and Statistics e-Journal, 8, 33–44.

Examples

mtcars_lm <- lm(mpg ~ wt + qsec + am, data = mtcars)
yuce(mtcars_lm, method = "A")
yuce(mtcars_lm, method = "B")


[Package skedastic version 2.0.2 Index]