pyhctsa.robust.bf_runs_z

pyhctsa.robust.bf_runs_z(y)

Signed z-statistic of a runs test for randomness about the median (hctsa BF_RunsZ).

Splits the values of y into those above the median and those at or below it, counts the runs and standardizes the count with its exact mean and variance under random order (Wald-Wolfowitz): z = (R - mu)/sigma, mu = 1 + 2 n1 n2/n, sigma^2 = 2 n1 n2 (2 n1 n2 - n) / (n^2 (n - 1)). z < 0 (too few runs) means positive serial dependence, z > 0 negative. If no value lies above the median the groups are instead those at the median and those below it.

Parameters:
y : array-like

A vector (NaN values are ignored).

Returns:

The standardized number of runs; NaN for a constant series, or when the null distribution of the number of runs has zero variance.

Return type:

float