stattest Package

stattest Package

ljungbox Module

pypr.stattest.ljungbox.boxpierce(x, lags, alpha=0.10000000000000001)

The Box-Pierce test for determining if the data is independently distributed.

Parameters :

x : 1d numpy array

Signal to test

lags : int

Number of lags being tested

Returns :

Q : float

Test statistic

pypr.stattest.ljungbox.lbqtest(x, lags, alpha=0.10000000000000001, method='lb')

The Ljung-Box test for determining if the data is independently distributed.

Parameters :

x : 1d numpy array

Signal to test

lags : list of ints

Lags being tested

alpha : float

Significance level used for the tests

method : string

Can be either ‘lb’ for Ljung-Box, or ‘bp’ for Box-Pierce

Returns :

h : np array

Numpy array of bool values, True == H0 hypothesis rejected

pV : np array

Test statistics p-values

Q : np array

Test statistics

cV : np array

Critical values used for determining if H0 should be rejected. The critical values are calculated from the given alpha and lag.

pypr.stattest.ljungbox.ljungbox(x, lags, alpha=0.10000000000000001)

The Ljung-Box test for determining if the data is independently distributed.

Parameters :

x : 1d numpy array

Signal to test

lags : int

Number of lags being tested

Returns :

Q : float

Test statistic

pypr.stattest.ljungbox.sac(x, k=1)

Sample autocorrelation (As used in statistics with normalization)

http://en.wikipedia.org/wiki/Autocorrelation

Parameters :

x : 1d numpy array

Signal

k : int or list of ints

Lags to calculate sample autocorrelation for

Returns :

res : scalar or np array

The sample autocorrelation. A scalar value if k is a scalar, and a numpy array if k is a interable.

Table Of Contents

This Page