pyhctsa.operations.stationarity.nstat_z¶
-
pyhctsa.operations.stationarity.nstat_z(y, num_seg=
5, embed_params=(1, 3))¶ Cross-forecast errors of zeroth-order time-series models.
A Python port of the
nstat_zroutine from the TISEAN package for nonlinear time-series analysis [1], which looks for nonstationarity in a time series by dividing it into a number of segments and calculating the cross-forecast errors between the different segments. The model is the zeroth-order model proposed by Schreiber: each point of the segment being forecast is predicted one step ahead by averaging what followed its nearest neighbors in the time-delay embedding of the predicting segment. The error between segment i (predicting) and segment j (forecast) is the root-mean-square forecast error divided by the standard deviation of segment j, collected in anum_segxnum_segmatrix. As in TISEAN, the series is first rescaled to [0, 1], neighbors are within a maximum-norm distance eps that grows (from 1e-3, by a factor 1.2) until there are at least 30 of them, and neighbors within the causality window of the forecast point are excluded. The window is applied to the position of each point within its own segment, so it also excludes the points at similar positions within the predicting segment when that segment differs from the forecast one.References
- Parameters:¶
- y : array-like¶
The input time series.
- num_seg : int, optional¶
The number of equally-spaced segments to divide the time series into, each used to predict the other segments. Default is 5.
- embed_params : tuple, optional¶
The embedding parameters
(tau, m): a time delay, tau (an integer, or a rule forpyhctsa.utils.get_tau(), e.g.'ac'or'ac1e'), and an embedding dimension, m (an integer). Default is(1, 3).
- Returns:¶
Statistics on the cross-prediction error matrix (below, ‘rows’ of the matrix are predicting segments, ‘columns’ are the segments forecast); NaN if the time series is too short for this many segments:
’trace’: the trace of the matrix (segments predicting themselves),
’mean’, ‘median’, ‘min’, ‘max’, ‘iqr’, ‘std’, ‘range’: of all entries of the matrix,
’minlower’, ‘minupper’: the minimum nonzero error below and above the diagonal,
’minoffdiag’, ‘iqroffdiag’, ‘stdoffdiag’, ‘rangeoffdiag’: the minimum, interquartile range, standard deviation, and range of the nonzero off-diagonal entries,
’stdmean’, ‘rangemean’, ‘stdmedian’, ‘rangemedian’: the standard deviation and range, across columns, of the column means and of the column medians,
’rangerange’, ‘stdrange’: the range and standard deviation, across columns, of the column ranges,
’rangestd’, ‘stdstd’: the range and standard deviation, across columns, of the column standard deviations,
’maximageig’, ‘minimageig’: the largest and smallest imaginary parts of the eigenvalues of the matrix,
’rangeeig’, ‘stdeig’, ‘mineig’, ‘maxeig’: the range, standard deviation, minimum, and maximum of the real parts of the eigenvalues.
- Return type:¶
dict