pyhctsa.operations.hypothesis_tests.independence_tests¶
-
pyhctsa.operations.hypothesis_tests.independence_tests(y, the_test=
'runsz')¶ Statistic or p-value of a test of serial independence.
Tests whether the values of the time series are independent of one another. Unlike the tests in
marginal_tests(), the result depends on the temporal order of the values. This is the part of hctsa’s formerHT_HypothesisTestthat tests dependence. The runs test is returned as its z-statistic (in closed form), the other tests as p-values.- Parameters:¶
- y : array-like¶
The input time series.
- the_test : {'runsz', 'runstest', 'lbq'}, optional¶
The test:
’runsz’: runs test for randomness of the runs of values above and below the median; returns the signed z-statistic of the number of runs (
pyhctsa.robust.bf_runs_z()): negative for fewer runs than expected (positive serial dependence), positive for more (alternation), and approximately standard normal under the null hypothesis;’runstest’: the p-value of the same hypothesis (runs above and below the mean, exact distribution of the number of runs);
’lbq’: Ljung-Box Q-test for autocorrelation up to lag 20.
Default is
'runsz'.
- Returns:¶
The z-statistic of the test for ‘runsz’, otherwise its p-value: the probability, under the null hypothesis, of a test statistic at least as extreme as that observed. Small values are evidence of serial dependence.
- Return type:¶
float