statsmodels.tsa.statespace.mlemodel.MLEResults.test_heteroskedasticity¶
- MLEResults.test_heteroskedasticity(method, alternative='two-sided', use_f=True)[source]¶
Test for heteroskedasticity of standardized residuals
Tests whether the sum-of-squares in the first third of the sample is significantly different than the sum-of-squares in the last third of the sample. Analogous to a Goldfeld-Quandt test. The null hypothesis is of no heteroskedasticity.
- Parameters
- method{‘breakvar’,
None
} The statistical test for heteroskedasticity. Must be ‘breakvar’ for test of a break in the variance. If None, an attempt is made to select an appropriate test.
- alternative
str
, ‘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).
- method{‘breakvar’,
- Returns
- output
ndarray
An array with (test_statistic, pvalue) for each endogenous variable. The array is then sized (k_endog, 2). If the method is called as het = res.test_heteroskedasticity(), then het[0] is an array of size 2 corresponding to the first endogenous variable, where het[0][0] is the test statistic, and het[0][1] is the p-value.
- output
Notes
The null hypothesis is of no heteroskedasticity.
For \(h = [T/3]\), the test statistic is:
\[H(h) = \sum_{t=T-h+1}^T \tilde v_t^2 \Bigg / \sum_{t=d+1}^{d+1+h} \tilde v_t^2\]where \(d\) = max(loglikelihood_burn, nobs_diffuse)` (usually corresponding to diffuse initialization under either the approximate or exact approach).
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=True as an argument.
See section 5.4 of [1] for the above formula and discussion, as well as additional details.
TODO
Allow specification of \(h\)
References
- 1
Harvey, Andrew C. 1990. Forecasting, Structural Time Series Models and the Kalman Filter. Cambridge University Press.