arch.unitroot.VarianceRatio¶
- class
arch.unitroot.
VarianceRatio
(y, lags=2, trend='c', debiased=True, robust=True, overlap=True)[source]¶ Variance Ratio test of a random walk.
- Parameters
y ({ndarray, Series}) -- The data to test for a random walk
lags (int) -- The number of periods to used in the multi-period variance, which is the numerator of the test statistic. Must be at least 2
trend ({'nc', 'c'}, optional) -- 'c' allows for a non-zero drift in the random walk, while 'nc' requires that the increments to y are mean 0
overlap (bool, optional) -- Indicates whether to use all overlapping blocks. Default is True. If False, the number of observations in y minus 1 must be an exact multiple of lags. If this condition is not satisfied, some values at the end of y will be discarded.
robust (bool, optional) -- Indicates whether to use heteroskedasticity robust inference. Default is True.
debiased (bool, optional) -- Indicates whether to use a debiased version of the test. Default is True. Only applicable if overlap is True.
Notes
The null hypothesis of a VR is that the process is a random walk, possibly plus drift. Rejection of the null with a positive test statistic indicates the presence of positive serial correlation in the time series.
Examples
>>> from arch.unitroot import VarianceRatio >>> import datetime as dt >>> import pandas_datareader as pdr >>> data = pdr.get_data_fred('DJIA') >>> data = data.resample('M').last() # End of month >>> returns = data['DJIA'].pct_change().dropna() >>> vr = VarianceRatio(returns, lags=12) >>> print('{0:0.4f}'.format(vr.pvalue)) 0.0000
References
- *
Campbell, John Y., Lo, Andrew W. and MacKinlay, A. Craig. (1997) The Econometrics of Financial Markets. Princeton, NJ: Princeton University Press.
Methods
summary
()Summary of test, containing statistic, p-value and critical values
Properties
The alternative hypothesis
Dictionary containing critical values specific to the test, number of observations and included deterministic trend terms.
Sets of gets the indicator to use debiased variances in the ratio
Sets or gets the number of lags used in the model.
The number of observations used when computing the test statistic.
The null hypothesis
Sets of gets the indicator to use overlapping returns in the long-period variance estimator
Returns the p-value for the test statistic
Sets of gets the indicator to use a heteroskedasticity robust variance estimator
The test statistic for a unit root
Sets or gets the deterministic trend term used in the test.
List of valid trend terms.
The ratio of the long block lags-period variance to the 1-period variance
Returns the data used in the test statistic