# Goldfeld–Quandt test A parametric test for equal variance can be visualized by indexing the data by some variable, removing data points in the center and comparing the mean deviations of the left and right side.

In statistics, the Goldfeld–Quandt test checks for homoscedasticity in regression analyses. It does this by dividing a dataset into two parts or groups, and hence the test is sometimes called a two-group test. The Goldfeld–Quandt test is one of two tests proposed in a 1965 paper by Stephen Goldfeld and Richard Quandt. Both a parametric and nonparametric test are described in the paper, but the term "Goldfeld–Quandt test" is usually associated only with the former.

## Test The nonparametric test can be visualized by comparing the number of 'peaks' in the residuals from a regression ordered against a pre-identified variable with how many peaks would arise randomly. The lower figure is provided only for comparison, no part of the test involves visual comparison with a hypothetical homoskedastic error structure.

In the context of multiple regression (or univariate regression), the hypothesis to be tested is that the variances of the errors of the regression model are not constant, but instead are monotonically related to a pre-identified explanatory variable. For example, data on income and consumption may be gathered and consumption regressed against income. If the variance increases as levels of income increase, then income may be used as an explanatory variable. Otherwise some third variable (e.g. wealth or last period income) may be chosen.

## Parametric test

The parametric test is accomplished by undertaking separate least squares analyses on two subsets of the original dataset: these subsets are specified so that the observations for which the pre-identified explanatory variable takes the lowest values are in one subset, with higher values in the other. The subsets needs not be of equal size, nor contain all the observations between them. The parametric test assumes that the errors have a normal distribution. There is an additional assumption here, that the design matrices for the two subsets of data are both of full rank. The test statistic used is the ratio of the mean square residual errors for the regressions on the two subsets. This test statistic corresponds to an F-test of equality of variances, and a one- or two-sided test may be appropriate depending on whether or not the direction of the supposed relation of the error variance to the explanatory variable is known.

Increasing the number of observations dropped in the "middle" of the ordering will increase the power of the test but reduce the degrees of freedom for the test statistic. As a result of this tradeoff it is common to see the Goldfeld–Quandt test performed by dropping the middle third of observations with smaller proportions of dropped observations as sample size increases.

## Nonparametric test

The second test proposed in the paper is a nonparametric one and hence does not rely on the assumption that the errors have a normal distribution. For this test, a single regression model is fitted to the complete dataset. The squares of the residuals are listed according to the order of the pre-identified explanatory variable. The test statistic used to test for homogeneity is the number of peaks in this list: ie. the count of the number of cases in which a squared residual is larger than all previous squared residuals. Critical values for this test statistic are constructed by an argument related to permutation tests.

The parametric Goldfeld–Quandt test offers a simple and intuitive diagnostic for heteroskedastic errors in a univariate or multivariate regression model. However some disadvantages arise under certain specifications or in comparison to other diagnostics, namely the Breusch–Pagan test, as the Goldfeld–Quandt test is somewhat of an ad hoc test. Primarily, the Goldfeld–Quandt test requires that data be ordered along a known explanatory variable. The parametric test orders along this explanatory variable from lowest to highest. If the error structure depends on an unknown variable or an unobserved variable the Goldfeld–Quandt test provides little guidance. Also, error variance must be a monotonic function of the specified explanatory variable. For example, when faced with a quadratic function mapping the explanatory variable to error variance the Goldfeld–Quandt test may improperly accept the null hypothesis of homoskedastic errors.[citation needed]

### Robustness

Unfortunately the Goldfeld–Quandt test is not very robust to specification errors. The Goldfeld–Quandt test detects non-homoskedastic errors but cannot distinguish between heteroskedastic error structure and an underlying specification problem such as an incorrect functional form or an omitted variable. Jerry Thursby proposed a modification of the Goldfeld–Quandt test using a variation of the Ramsey RESET test in order to provide some measure of robustness.

## Small sample properties

Herbert Glejser, in his 1969 paper outlining the Glejser test, provides a small sampling experiment to test the power and sensitivity of the Goldfeld–Quandt test. His results show limited success for the Goldfeld–Quandt test except under cases of "pure heteroskedasticity"—where variance can be described as a function of only the underlying explanatory variable.

## Software implementations

• In R, the Goldfeld-Quandt Test can be implemented using the `gqtest` function of the `lmtest` package (parametric F test only), or using the `goldfeld_quandt` function of the `skedastic` package (both parametric F test and nonparametric peaks test).