# Pcapro

Jump to navigation
Jump to search

### Purpose

Project new data onto an existing principal components model.

### Synopsis

- [scoresn,resn,tsqn] = pcapro(newdata,loads,ssq,reslm,tsqlm,
*plots*) - [scoresn,resn,tsqn] = pcapro(newdata,pcamod,
*plots*)

### Description

This function applies a previously-determined PCA model to a set of new data `newdata`. The PCA model can be input in one of two possible forms: 1) as a list of input variables, or 2) as a single model structure variable that had been previously returned by analysis or pca.

For case 1), the scaling for `newdata` should be the same as for the original data used to build the model. For case 2), **pcapro** will scale `newdata` based on data contained in `pcamod`

#### Inputs

- Case 1) model input as a list of variables:
**newdata**= data to be applied to the existing PCA model,*scaled the same as the original data used to build the model***loads**= the model loadings**ssq**= the model variance information**reslm**= the limit for Q residuals**tsqlm**= the limit for T^{2}**plots**= optional variable, which suppresses plotting when set to 0 {default**plots**= 1}.

- Case 2) model input as a single model structure:
**newdata**= data to be applied to the existing PCA model,*in the units of the original data***pcamod**= the structure variable that contains the PCA model**plots**= optional variable, which suppresses the plots when set to 0 {default**plots**= 1}.

#### Outputs

**scoressn**= the new scores**resn**= new residuals**tsqn**= new T^{2}values