From Eigenvector Research Documentation Wiki
Revision as of 08:21, 2 September 2008 by imported>Jeremy (Importing text file)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Replace variables based on principal component analysis (PCA) or partial least squares (PLS) regression models.


rm = replace(model,vars)
[rm,repdata] = replace(model,vars,data)
repdata = replace(model,data)


REPLACE replaces variables from data matrices with values most consistent with the given PCA or PLS model. Input model can be any of the following: 1) a standard model structure generated by the PCA or PLS functions or the Anlysis GUI 2) a set of loading column vectors (e.g., loads returned by the pca routine, or model.loads{2} if the output is a model structure) 3) the PCA residual generating matrix (I-loads\*loads�), or 4) the PLS residuals generating matrix coeff returned by the plsrsgn routine. Optional input vars is a row vector containing the indices of the variables (columns) to be replaced. If omitted, the input data is searched for non-finite values (NaN, Inf) and these values are replaced. When vars in input, the outputs are the replacement matrix rm and the replaced data (if data was provided), repdata. Multiplication of a data matrix xnew by rm will replace variables with values most consistent with the given PCA or PLS model. If vars was not supplied, only repdata is output.


A PCA model was created on a data matrix xold giving a model structure model. The loadings, a set of loadings column vectors, were extracted to a variable loads using loads = model.loads{2};. It was found that the sensor measuring variable 9 has gone "bad" and we would like to replace it in the new data matrix xnew. A replacement matrix rm is first created using replace. rm = replace(loads,9); The new data matrix with variable 9 replaced rxnew is then calculated by multiplying xnew by rm. rxnew = xnew\*rm;

See Also

mdcheck, pca, plsrsgcv, plsrsgn