statsmodels.tsa.stattools.breakvar_heteroskedasticity_test

statsmodels.tsa.stattools.breakvar_heteroskedasticity_test(resid, subset_length=0.3333333333333333, alternative='two-sided', use_f=True)[source]

Test for heteroskedasticity of residuals

Tests whether the sum-of-squares in the first subset of the sample is significantly different than the sum-of-squares in the last subset of the sample. Analogous to a Goldfeld-Quandt test. The null hypothesis is of no heteroskedasticity.

Parameters:
residarray_like

Residuals of a time series model. The shape is 1d (nobs,) or 2d (nobs, nvars).

subset_length{int, float}

Length of the subsets to test (h in Notes below). If a float in 0 < subset_length < 1, it is interpreted as fraction. Default is 1/3.

alternativestr, ‘increasing’, ‘decreasing’ or ‘two-sided’

This specifies the alternative for the p-value calculation. Default is two-sided.

use_fbool, optional

Whether or not to compare against the asymptotic distribution (chi-squared) or the approximate small-sample distribution (F). Default is True (i.e. default is to compare against an F distribution).

Returns:
test_statistic{float, ndarray}

Test statistic(s) H(h).

p_value{float, ndarray}

p-value(s) of test statistic(s).

Notes

The null hypothesis is of no heteroskedasticity. That means different things depending on which alternative is selected:

  • Increasing: Null hypothesis is that the variance is not increasing

    throughout the sample; that the sum-of-squares in the later subsample is not greater than the sum-of-squares in the earlier subsample.

  • Decreasing: Null hypothesis is that the variance is not decreasing

    throughout the sample; that the sum-of-squares in the earlier subsample is not greater than the sum-of-squares in the later subsample.

  • Two-sided: Null hypothesis is that the variance is not changing

    throughout the sample. Both that the sum-of-squares in the earlier subsample is not greater than the sum-of-squares in the later subsample and that the sum-of-squares in the later subsample is not greater than the sum-of-squares in the earlier subsample.

For \(h = [T/3]\), the test statistic is:

\[H(h) = \sum_{t=T-h+1}^T \tilde v_t^2 \Bigg / \sum_{t=1}^{h} \tilde v_t^2\]

This statistic can be tested against an \(F(h,h)\) distribution. Alternatively, \(h H(h)\) is asymptotically distributed according to \(\chi_h^2\); this second test can be applied by passing use_f=False as an argument.

See section 5.4 of [1] for the above formula and discussion, as well as additional details.

References

[1]

Harvey, Andrew C. 1990. Forecasting, Structural Time Series Models and the Kalman Filter. Cambridge University Press.


Last update: Apr 16, 2024