statsmodels.stats.diagnostic.het_goldfeldquandt(y, x, idx=None, split=None, drop=None, alternative='increasing', store=False)[source]

Goldfeld-Quandt homoskedasticity test.

This test examines whether the residual variance is the same in 2 subsamples.


endogenous variable


exogenous variable, regressors

idxint, default None

column index of variable according to which observations are sorted for the split

split{int, float}, default None

If an integer, this is the index at which sample is split. If a float in 0<split<1 then split is interpreted as fraction of the observations in the first sample. If None, uses nobs//2.

drop{int, float}, default None

If this is not None, then observation are dropped from the middle part of the sorted series. If 0<split<1 then split is interpreted as fraction of the number of observations to be dropped. Note: Currently, observations are dropped between split and split+drop, where split and drop are the indices (given by rounding if specified as fraction). The first sample is [0:split], the second sample is [split+drop:]

alternative{“increasing”, “decreasing”, “two-sided”}

The default is increasing. This specifies the alternative for the p-value calculation.

storebool, default False

Flag indicating to return the regression results


value of the F-statistic


p-value of the hypothesis that the variance in one subsample is larger than in the other subsample


The ordering used in the alternative.

res_storeResultsStore, optional

Storage for the intermediate and final results that are calculated


The Null hypothesis is that the variance in the two sub-samples are the same. The alternative hypothesis, can be increasing, i.e. the variance in the second sample is larger than in the first, or decreasing or two-sided.

Results are identical R, but the drop option is defined differently. (sorting by idx not tested yet)

Last update: Dec 14, 2023