TSA Principal Component Analysis VI
- Updated2024-07-30
- 3 minute(s) read
Performs principal component analysis (PCA) on a multivariate (vector) time series. Wire data to the Xt input to determine the polymorphic instance to use or manually select the instance.

TSA Principal Component Analysis Details
Principal component analysis (PCA) computes a new set of uncorrelated multivariate (vector) time series by a transform of coordinate rotation from original correlated multivariate time series.
This VI performs PCA according to the following steps:
1. Calculates the covariance/correlation coefficient matrix
This VI calculates the covariance matrix according to the following equation:

where w = N-1, N is the number of time series samples. The dimension of the covariance matrix is mxm.
This VI calculates the correlation coefficient matrix according to the following equation:

If unified? is TRUE, this VI calculates the correlation coefficients matrix first and then performs PCA. If unified? is FALSE, this VI calculates the covariance matrix first, and then performs PCA.
2. Calculates the eigenvectors and eigenvalues of the matrix
This VI obtains the m eigenvalues li and eigenvectors vi from either covariance matrix or correlation matrix. li and vi satisfy the following equation:
AVi = liVi, i=1,…, m
where A is an mxm covariance matrix or correlation matrix.
3. Generates the new time series
This VI then computes a new set of uncorrelated multivariate (vector) time series according to the following equation:
Xtnew=VTXt
where Xtnew is the new uncorrelated multivariate (vector) time series, and Xt is the original correlated multivariate (vector) time series. Both of them are mxn matrices whose row vectors represent a single channel time series. V is eigenvectors matrix [v1, v2,…, vm].
V also is the weight matrix. Each column of V is one principle component. Xtnew also is the principal component scores. Each row of Xtnew is the scores for one principal component. Each li is variance of the scores for one principal component.
Examples
Refer to the following VIs for examples of using the TSA Principal Component Analysis VI:
- Principal Component Analysis VI: labview\examples\Time Series Analysis\TSAGettingStarted
- Image Compression with PCA VI: labview\examples\Time Series Analysis\TSAApplications