statsmodels.tsa.stattools.bds

statsmodels.tsa.stattools.bds(x, max_dim=2, epsilon=None, distance=1.5)[source]

Calculate the BDS test statistic for independence of a time series

Parameters
  • x (1d array) – observations of time series for which bds statistics is calculated

  • max_dim (integer) – maximum embedding dimension

  • epsilon (scalar, optional) – the threshold distance to use in calculating the correlation sum

  • distance (scalar, optional) – if epsilon is omitted, specifies the distance multiplier to use when computing it

Returns

  • bds_stat (float) – The BDS statistic

  • pvalue (float) – The p-values associated with the BDS statistic

Notes

The null hypothesis of the test statistic is for an independent and identically distributed (i.i.d.) time series, and an unspecified alternative hypothesis.

This test is often used as a residual diagnostic.

The calculation involves matrices of size (nobs, nobs), so this test will not work with very long datasets.

Implementation conditions on the first m-1 initial values, which are required to calculate the m-histories: x_t^m = (x_t, x_{t-1}, … x_{t-(m-1)})