naginterfaces.library.tsa.uni_​diff

naginterfaces.library.tsa.uni_diff(x, nd, nds, ns)[source]

uni_diff carries out non-seasonal and seasonal differencing on a time series. Information which allows the original series to be reconstituted from the differenced series is also produced. This information is required in time series forecasting.

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

https://www.nag.com/numeric/nl/nagdoc_27.1/flhtml/g13/g13aaf.html

Parameters
xfloat, array-like, shape

The undifferenced time series, , for .

ndint

, the order of non-seasonal differencing.

ndsint

, the order of seasonal differencing.

nsint

, the seasonality.

Returns
xdfloat, ndarray, shape

The differenced values in elements to , and reconstitution data in the remainder of the array.

nxdint

The number of differenced values in the array .

Raises
NagValueError
(errno )

On entry, .

Constraint: if , .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, , , and .

Constraint: .

Notes

Let be the th value of a time series , for after non-seasonal differencing of order and seasonal differencing of order (with period or seasonality ). In general,

Non-seasonal differencing up to the required order is obtained using

for

for

for

Seasonal differencing up to the required order is then obtained using

for

for

for

Mathematically, the sequence in which the differencing operations are performed does not affect the final resulting series of values.