analysis module
The eigval_tsa.analysis module contains the necessary tools for an eigenvalue estimation of a system that is described by a single time series. The optimal parameters for the analysis can be calculated using the module eigval_tsa.param_opt.
The eigval_tsa.analysis module contains the functions
interaction_coeff_calc(data, order)
jacobian(AR_params)
max_eigenvalue_calc(matrix)
AR_EV_calc(...)
detrend_fct(...)
These functions are explained in the following.
- antiCPy.early_warnings.dominant_eigenvalue.analysis.interaction_coeff_calc(data, order, cov_type)[source]
- Parameters:
data (One dimensional numpy array of floats.) – A one dimensional numpy array containing the times series interval for an autoregressive analysis.
order (Integer with \(order \in \mathbb{N} \setminus \{ 0, 1\}\).) – The optimal embedding dimension. This is equivalent to the order of the autoregressive model that should be fitted to the data.
- Returns:
The function first returns the fitted parameters of the autoregression model that is applied to the data. The first entry is the intercept of the model, the following entry the coefficient of the one time lagged contribution, the third entry is of the two time lagged contribution and so on. The function second returns the fit object of the autoregressive model created with
statsmodels.tsa.ar_model.AR.- Return type:
The first return is a one dimensional array of length
order + 1. The second return is an fit object ofstatsmodels.tsa.ar_model.AR.
- antiCPy.early_warnings.dominant_eigenvalue.analysis.jacobian(AR_params)[source]
- Parameters:
AR_params (One dimensional array of floats.) – The parameters that represent the first row of the specially designed Jacobian. The name suggests the AR coefficients of a given time series as they are given by the function
eigval_tsa.analysis.interaction_coeff_calcwith the intercept of the AR model as the first entry, the coefficient of the one time lagged contribution as the second entry and so on.- Returns:
The result is a two dimensional numpy array with a Jacobian of the specific design.
- Return type:
A two dimensional numpy array.
- antiCPy.early_warnings.dominant_eigenvalue.analysis.max_eigenvalue_calc(matrix)[source]
- Parameters:
matrix (Two dimensional square numpy array.) – A two dimensional square matrix.
- Returns:
The result contains two objects. The first one is a single float containing the absolute maximum of the eigenvalues. The second return object contains a one dimensional array with all eigenvalues of the given matrix. The array is not ordered.
- Return type:
The first object is a float. The second object is a one dimensional array.
- antiCPy.early_warnings.dominant_eigenvalue.analysis.AR_EV_calc(gendata, rolling_window_size, order, show_steps=False, detrend=False, detrend_mode='linear', gauss_filter_mode='reflect', gauss_filter_sigma=6, gauss_filter_order=0, gauss_filter_cval=0.0, gauss_filter_truncate=4.0, cov_type='HC1')[source]
- Parameters:
gendata (One dimensional numpy array.) – Defines the time series or data interval of which the eigenvalues will be estimated.
rolling_window_size (integer) – Defines the number of time series or data elements of gendata that will be used for one eigenvalue estimation in time.
order (integer) – Defines the order of the autoregression scheme that is used for the eigenvalue estimation. The optimal order can be estimated with the function
eigval_tsa.param_opt.false_NN.show_steps (Boolean.) – If
True, the window number of the current calculation is printed. Default isFalse.detrend (Boolean.) – If
True, the data windows are detrended according to the specified detrending parameters. Default is `` False``.detrend_mode (String.) – Each window is linearly detrended for `` detrend = ‘linear’`` and with a Gaussian kernel filter via
detrend = 'gauss_kernel'. The linear detrending is the default option.gauss_filter_mode (String.) – According to the
scipy.ndimage.filters.gaussian_filteroption.gauss_filter_sigma (Float.) – According to the
scipy.ndimage.filters.gaussian_filteroption.gauss_filter_order (Integer.) – According to the
scipy.ndimage.filters.gaussian_filteroption.gauss_filter_cval (Float.) – According to the
scipy.ndimage.filters.gaussian_filteroption.gauss_filter_truncate (Float.) – According to the
scipy.ndimage.filters.gaussian_filteroption.
- Returns:
The functions returns two objects. The first object is a one dimensional numpy array that contains the absolute maximum value of the eigenvalues that are calculated for windows of the chosen rolling_window_size. The windows are shifted by one in each iteration. The array should have the length
gendata.size-rolling_window_size+1. The second object is a two dimensional numpy array with all eigenvalues of each window. All eigenvalues of a given time series window are represented by a row of this matrix.- Return type:
The first object that is returned is a one dimensional numpy array of the length
order + 1. The second object is a two dimensional numpy array of the dimensionsgendata.size-rolling_window_size+1:math:`` imes``order.
- antiCPy.early_warnings.dominant_eigenvalue.analysis.detrend_fct(gendata, detrend_mode='linear', gauss_filter_mode='reflect', gauss_filter_sigma=6, gauss_filter_order=0, gauss_filter_cval=0.0, gauss_filter_truncate=4.0)[source]
- Parameters:
gendata (One dimensional numpy array.) – Time series that is to be detrended.
detrend_mode (String.) – Each window is linearly detrended for
detrend = 'linear'and with a Gaussian kernel filter viadetrend = 'gauss_kernel'. The linear detrending is the default option.gauss_filter_mode (String.) – According to the
scipy.ndimage.filters.gaussian_filteroption.gauss_filter_sigma (Float.) – According to the
scipy.ndimage.filters.gaussian_filteroption.gauss_filter_order (Integer.) – According to the
scipy.ndimage.filters.gaussian_filteroption.gauss_filter_cval (Float.) – According to the
scipy.ndimage.filters.gaussian_filteroption.gauss_filter_truncate (Float.) – According to the
scipy.ndimage.filters.gaussian_filteroption.
- Returns:
With
detrend_mode = 'linear'the linear detrended data is returned in form of a one-dimensional numpy array. Withdetrend_mode = 'gaussian_kernel'the modeled slow trend of the Gaussian filter is subtracted from the data. The detrended version is returned in form of a one-dimensional numpy array.- Return type:
All possible return objects are one-dimensional numpy arrays.