arch.unitroot.VarianceRatio¶
- 
class arch.unitroot.VarianceRatio(y: ndarray | DataFrame | Series, lags: int = 2, trend: 'n' | 'c' ='c', debiased: bool =True, robust: bool =True, overlap: bool =True)[source]¶
- Variance Ratio test of a random walk. - Parameters:¶
- y: ndarray | DataFrame | Series¶
- The data to test for a random walk 
- lags: int = 2¶
- 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: 'n' | 'c' = 'c'¶
- “c” allows for a non-zero drift in the random walk, while “n” requires that the increments to y are mean 0 
- overlap: bool = True¶
- 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 = True¶
- Indicates whether to use heteroskedasticity robust inference. Default is True. 
- debiased: bool = True¶
- 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. See [1] for details about variance ratio testing. - Examples - >>> from arch.unitroot import VarianceRatio >>> import pandas_datareader as pdr >>> data = pdr.get_data_fred("DJIA", start="2010-1-1", end="2020-12-31") >>> data = np.log(data.resample("M").last()) # End of month >>> vr = VarianceRatio(data, lags=12) >>> print(f"{vr.pvalue:0.4f}") 0.1370- References - 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