Goldfeld-Quandt Test

The Goldfeld-Quandt Test of Goldfeld and Quandt (1965) splits the sample in time instead: it fits the regression again on the first and on the second half and compares their residual variances, so it detects a variance that rose or fell over the sample, a calmer or a more turbulent period.

The formula for the Goldfeld-Quandt Test splits the n observations into a first part of \(n_{1}\) and a second part of \(n_{2}\):

\[n_{1} = \left\lfloor \frac{n}{2}\right\rfloor\] \[n_{2} = n - n_{1}\]

It fits the regression on each part by OLS and takes the ratio of their residual variances:

\[F = \frac{\frac{\text{SSR}_{2}}{n_{2} - k}}{\frac{\text{SSR}_{1}}{n_{1} - k}}\]

Where \(\text{SSR}_{1}\) and \(\text{SSR}_{2}\) are the residual sums of squares of the two fits and k the number of parameters. F is F-distributed with \(n_{2} - k\) and \(n_{1} - k\) degrees of freedom under the null: homoskedasticity is rejected when the two-sided p-value, twice the smaller tail probability, is below the significance level (0.05 for the 5% level). F above 1 means the second half was more volatile, below 1 the first. It only detects a variance that differs between the two halves, and a change in the coefficients between them also moves it.

OLS standard errors assume that the residual variance is constant (homoskedasticity). When it is not, the coefficients stay unbiased, but the standard errors, t-statistics and p-values of the regression are unreliable. A test for heteroskedasticity asks whether the residual variance is constant, the null hypothesis, or moves with the regressors or over time, the alternative. In returns it usually does: errors grow when the market moves more, and volatility clusters in turbulent periods. A rejection calls for a robust (heteroskedasticity-consistent) covariance or weighted least squares.

Also known as: GQ test, split-sample variance test.

In the Finance Toolkit this is get_heteroskedasticity_test with method="goldfeld_quandt", the same function as Heteroskedasticity Test.

Example · CAT, DE · 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_heteroskedasticity_test:

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["CAT", "DE"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2025-01-01",
    end_date="2025-12-31",
)

# CAT (the first ticker) is dependent; DE is independent
toolkit.econometrics.get_heteroskedasticity_test(method="goldfeld_quandt")

Which returns:

Item 0
Goldfeld-Quandt F-Statistic 1.4776
P-Value 0.0317
Reject Homoskedasticity (5%) 1

Using Your Own Data

get_heteroskedasticity_test runs on any data, not only prices: ratios, economic indicators, yield curves or your own dataset. Pass a DataFrame, a Series or a dictionary of them to Econometrics as data, with the dates in the rows or the columns, and set changes to how its changes are calculated: "percentage", "log", "difference" for rates and ratios, or None when the data are changes already. For example, for the monthly unemployment rates of the United States and Germany:

from financetoolkit import Economics, Econometrics

economics = Economics(start_date="2000-01-01")

unemployment = economics.get_unemployment_rate(
    countries=["United States", "Germany"], period="monthly"
)

econometrics = Econometrics(data=unemployment, changes="difference")

econometrics.get_heteroskedasticity_test()

References

  • Paper Goldfeld, S.M. and Quandt, R.E. (1965). “Some Tests for Homoscedasticity.” Journal of the American Statistical Association, 60(310), 539-547.
  • Library Referenced against statsmodels’ het_goldfeldquandt (Goldfeld-Quandt Test)
Share