arch.unitroot.ZivotAndrews

class arch.unitroot.ZivotAndrews(y: ndarray | DataFrame | Series, lags: int | None = None, trend: 'c' | 'ct' | 't' = 'c', trim: float = 0.15, max_lags: int | None = None, method: 'aic' | 'bic' | 't-stat' | 'maic' = 'aic')[source]

Zivot-Andrews structural-break unit-root test.

The Zivot-Andrews test can be used to test for a unit root in a univariate process in the presence of serial correlation and a single structural break.

Parameters:
y: ndarray | DataFrame | Series

The data series.

lags: int | None = None

The number of lags to use in the ADF regression. If omitted or None, method is used to automatically select the lag length with no more than max_lags lags included.

trend: 'c' | 'ct' | 't' = 'c'

The trend component to include in the test. Not case sensitive.

  • ”c” - Include a constant

  • ”t” - Include a linear time trend

  • ”ct” - Include a constant and linear time trend

trim: float = 0.15

Percentage of series at begin/end to exclude from break-period calculation in range [0, 0.333]. The number of observations that are excluded, int(nobs * trim), must be larger than the number of lags, so that trim cannot be 0.

max_lags: int | None = None

The maximum number of lags to use when selecting lag length.

method: 'aic' | 'bic' | 't-stat' | 'maic' = 'aic'

The method to use when selecting the lag length. Not case sensitive.

  • ”aic” - Select the minimum of the Akaike IC

  • ”bic” - Select the minimum of the Schwarz/Bayesian IC

  • ”t-stat” - Select the largest lag length for which the t-statistic of the last lag is significant, using a cut-off of 1.645 for the absolute value of the t-statistic

  • ”maic” - Select the minimum of Ng and Perron’s modified Akaike IC

Raises:
  • TypeError – If y cannot be converted to numbers, lags or max_lags is not an integer, trim is not a real number, or trend or method is not a str.

  • ValueError – If y is not 1-d or contains NaN or inf, lags or max_lags is negative, trim is not in [0, 1/3], or trend or method is not one of the options.

  • InfeasibleTestException – If y has too few observations for trend, lags or max_lags, or int(nobs * trim) is too small for lags and trend. This is also a ValueError.

Notes

H0 = unit root with a single structural break

Algorithm follows Baum (2004/2015) approximation to original Zivot-Andrews method. Rather than performing an autolag regression at each candidate break period (as per the original paper), a single autolag regression is run up-front on the base model (constant + trend with no dummies) to determine the best lag length. This lag length is then used for all subsequent break-period regressions. This results in significant run time reduction but also slightly more pessimistic test statistics than the original Zivot-Andrews method.

No attempt has been made to characterize the size/power trade-off.

Based on the description in Zivot and Andrews [3]. See [2] for a general discussion of unit root tests. Code tested against Baum [1].

References

Methods

summary()

Summary of test, containing statistic, p-value and critical values.

Properties

alternative_hypothesis

The alternative hypothesis.

critical_values

The critical values of the test.

lags

The number of lags used in the model.

nobs

The number of observations used when computing the test statistic.

null_hypothesis

The null hypothesis.

pvalue

The p-value for the test statistic.

stat

The test statistic for a unit root.

trend

The deterministic trend term used in the test.

valid_trends

List of valid trend terms.

y

The data used in the test statistic.