naginterfaces.library.tsa.uni_​autocorr

naginterfaces.library.tsa.uni_autocorr(x, nk)[source]

uni_autocorr computes the sample autocorrelation function of a time series. It also computes the sample mean, the sample variance and a statistic which may be used to test the hypothesis that the true autocorrelation function is zero.

For full information please refer to the NAG Library document for g13ab

https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g13/g13abf.html

Parameters
xfloat, array-like, shape

The time series, , for .

nkint

, the number of lags for which the autocorrelations are required. The lags range from to and do not include zero.

Returns
xmfloat

The sample mean of the input time series.

xvfloat

The sample variance of the input time series.

rfloat, ndarray, shape

The sample autocorrelation coefficient relating to lag , for .

statfloat

The statistic used to test the hypothesis that the true autocorrelation function of the time series is identically zero.

Raises
NagValueError
(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

Warns
NagAlgorithmicWarning
(errno )

On entry, all values of are practically identical.

Notes

In the NAG Library the traditional C interface for this routine uses a different algorithmic base. Please contact NAG if you have any questions about compatibility.

The data consists of observations , for from a time series.

The quantities calculated are

  1. The sample mean

  2. The sample variance (for )

  3. The sample autocorrelation coefficients of lags , where is a user-specified maximum lag, and , .

    The coefficient of lag is defined as

    See page 496 of Box and Jenkins (1976) for further details.

  4. A test statistic defined as

    which can be used to test the hypothesis that the true autocorrelation function is identically zero.

    If is large and is much smaller than , has a distribution under the hypothesis of a zero autocorrelation function. Values of in the upper tail of the distribution provide evidence against the hypothesis; stat.prob_chisq can be used to compute the tail probability.

    Section 8.2.2 of Box and Jenkins (1976) provides further details of the use of .

References

Box, G E P and Jenkins, G M, 1976, Time Series Analysis: Forecasting and Control, (Revised Edition), Holden–Day