TimeSeriesSRC.sdiff¶
- TimeSeriesSRC.sdiff(y, d, p=1)¶
Apply seasonal (or regular) differencing to a time series.
Computes the
d-th order difference at periodp:\[\nabla_p^d\, y(t) = \nabla_p^{d-1}\, y(t) - \nabla_p^{d-1}\, y(t-p)\]For
p = 1this reduces to ordinary differencing (numpy.diff).- Parameters:
- Returns:
yd – Differenced series. Each application of the operator reduces the length by
p.- Return type:
ndarray, shape (1, N - d*p)
- Raises:
Exception – If
d * pis larger than or equal to the length ofy.
Examples
>>> import numpy as np >>> from TimeSeriesSRC.basefunctions.sdiff import func_sdiff >>> y = np.arange(1.0, 21.0) >>> yd = func_sdiff(y, d=1, p=4) # seasonal difference at lag 4 >>> yd.shape (1, 16)
See also
uniAnalPasses
diff/perarguments directly to this function.