Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

TSA Principal Component Analysis VI

Owning Palette: Statistical Analysis VIs

Installed With: Advanced Signal Processing Toolkit

Performs principal component analysis (PCA) on an input multivariate (vector) time series. Wire data to the Xt input to determine the polymorphic instance to use or manually select the instance.

Details  Example

Use the pull-down menu to select an instance of this VI.

TSA Principal Component Analysis (waveform)

Xt specifies the input multivariate (vector) time series.
error in describes error conditions that occur before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.
status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.
code is the error or warning code. The default is 0. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source specifies the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.
unified? specifies to remove the mean and then unify Xt before performing PCA. The default is FALSE.
Xt out returns the computed principal component scores.
variance returns the variance values of the calculated principal component scores.
weights returns the weight matrix that this VI used when computing principal component scores from input multivariate time series.
error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out front panel indicator and select Explain Error from the shortcut menu for more information about the error.
status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.
code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning.

TSA Principal Component Analysis (array)

Xt specifies the input multivariate (vector) time series. Each column of the 2D array represents a vector at certain time.
error in describes error conditions that occur before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.
status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.
code is the error or warning code. The default is 0. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source specifies the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.
unified? specifies to remove the mean and then unify Xt before performing PCA. The default is FALSE.
Xt out returns the computed principal component scores. Each column of the 2D array represents a series of the computed principal component scores.
variance returns the variance values of the calculated principal component scores.
weights returns the weight matrix that this VI used when computing principal component scores from input multivariate time series.
error out contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out front panel indicator and select Explain Error from the shortcut menu for more information about the error.
status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.
code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.
source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning.

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 m×m.

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 m×m 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 m×n 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.

Example

Refer to the Principal Component Analysis VI in the labview\examples\Time Series Analysis\TSAGettingStarted.llb for an example of using the TSA Principal Component Analysis VI.


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit