mvtsa.representation.select_dpca_lag#
- mvtsa.representation.select_dpca_lag(X, max_lag=5, method='drop', ratio=8.0, threshold=0.01)[source]#
Number of lags of dynamic PCA.
method="drop"(default): the smallest eigenvalue of the covariance of the lag-extended, standardized data measures how exactly the best linear relation among the lagged variables holds. A lag that completes a dynamic relation decreases it by orders of magnitude, a superfluous lag only slightly; the selected lag is the last one at which the smallest eigenvalue (relative to the largest) drops by more thanratio.method="ku": the procedure of Ku, Storer and Georgakis (1995). Forl = 0, 1, ...the number of (near-)zero eigenvaluesr(l)(belowthresholdtimes the largest) counts the linear relations; the number of new relations is \(r_{new}(l) = r(l) - \sum_{i<l}(l-i+1)\,r_{new}(i)\) and the lag is increased until no new relation appears. Slow dynamics and step-like inputs create approximate relations that this count is sensitive to.Examples
>>> from mvtsa.datasets import make_dynamic_switching >>> [select_dpca_lag(make_dynamic_switching(order, random_state=1)[0][:300]) for order in (1, 2)] [1, 2]