pyhctsa.operations.hypothesis_tests.variance_ratio_test

pyhctsa.operations.hypothesis_tests.variance_ratio_test(y, periods=2, iids=0)

Variance ratio test for random walk.

Implements the Lo-MacKinlay (1988) variance ratio test (via arch.unitroot.VarianceRatio).

The test assesses the null hypothesis of a random walk in the time series, which is rejected for some critical p-value.

Parameters:
y : array-like

The input time series.

periods : int or list of int, optional

A scalar or vector of period(s) to use for the test. Default is 2.

iids : int or list of int, optional

A scalar or vector of boolean values (0 or 1) indicating whether to assume independent and identically distributed (IID) innovations for each period. Default is 0.

Returns:

For a single period: pValue, stat (the test statistic) and ratio (the variance ratio). For several periods: the period and IID flag of the test with the largest and smallest p-value (periodmaxpValue, periodminpValue, IIDperiodmaxpValue, IIDperiodminpValue), the mean, max and min test statistic (meanstat, maxstat, minstat), and the mean, max and min variance ratio (meanratio, maxratio, minratio).

Return type:

dict

Notes

The tests with the largest and smallest p-value are found from the absolute test statistic, which orders the tests exactly as the (two-sided) p-value does but, unlike it, does not saturate at 0 for strong departures from a random walk (where the extremes of the p-values would be decided by the floor of double precision).