6.8.3. statsmodels.sandbox.stats.diagnostic

Various Statistical Tests

Author: josef-pktd License: BSD-3

6.8.3.1. Notes

Almost fully verified against R or Gretl, not all options are the same. In many cases of Lagrange multiplier tests both the LM test and the F test is returned. In some but not all cases, R has the option to choose the test statistic. Some alternative test statistic results have not been verified.

TODO * refactor to store intermediate results * how easy is it to attach a test that is a class to a result instance,

for example CompareCox as a method compare_cox(self, other) ?
  • StatTestMC has been moved and should be deleted

missing:

  • pvalues for breaks_hansen
  • additional options, compare with R, check where ddof is appropriate
  • new tests: - breaks_ap, more recent breaks tests - specification tests against nonparametric alternatives

6.8.3.2. Functions

acf(x[, unbiased, nlags, qstat, fft, alpha]) Autocorrelation function for 1d arrays.
acorr_breush_godfrey(results[, nlags, store]) Breush Godfrey Lagrange Multiplier tests for residual autocorrelation
acorr_ljungbox(x[, lags, boxpierce]) Ljung-Box test for no autocorrelation
acorr_lm(x[, maxlag, autolag, store, regresults]) Lagrange Multiplier tests for autocorrelation
add_constant(data[, prepend, has_constant]) This appends a column of ones to an array if prepend==False.
adfuller(x[, maxlag, regression, autolag, ...]) Augmented Dickey-Fuller unit root test
breaks_AP(endog, exog, skip) supLM, expLM and aveLM by Andrews, and Andrews,Ploberger
breaks_cusumolsresid(olsresidual[, ddof]) cusum test for parameter stability based on ols residuals
breaks_hansen(olsresults) test for model stability, breaks in parameters for ols, Hansen 1992
het_arch(resid[, maxlag, autolag, store, ...]) Engle’s Test for Autoregressive Conditional Heteroscedasticity (ARCH)
het_breushpagan(resid, exog_het) Breush-Pagan Lagrange Multiplier test for heteroscedasticity
het_white(resid, exog[, retres]) White’s Lagrange Multiplier Test for Heteroscedasticity
iteritems(obj, **kwargs) replacement for six’s iteritems for Python2/3 compat
lagmat(x, maxlag[, trim, original]) create 2d array of lags
linear_harvey_collier(res) Harvey Collier test for linearity
linear_lm(resid, exog[, func]) Lagrange multiplier test for linearity against functional alternative
linear_rainbow(res[, frac]) Rainbow test for linearity
recursive_olsresiduals(olsresults[, skip, ...]) calculate recursive ols with residuals and cusum test statistic
unitroot_adf(x[, maxlag, trendorder, ...])

6.8.3.3. Classes

CompareCox Cox Test for non-nested models
CompareJ J-Test for comparing non-nested models
HetGoldfeldQuandt test whether variance is the same in 2 subsamples
OLS(endog[, exog, missing, hasconst]) A simple ordinary least squares model.
ResultsStore
StatTestMC(dgp, statistic) class to run Monte Carlo study on a statistical test’‘’