Main Content

processpca

Process columns of matrix with principal component analysis

Syntax

[Y,PS] = processpca(X,maxfrac)
[Y,PS] = processpca(X,FP)
Y = processpca('apply',X,PS)
X = processpca('reverse',Y,PS)
name = processpca('name')
fp = processpca('pdefaults')
names = processpca('pdesc')
processpca('pcheck',fp);

Description

processpca processes matrices using principal component analysis so that each row is uncorrelated, the rows are in the order of the amount they contribute to total variation, and rows whose contribution to total variation are less than maxfrac are removed.

[Y,PS] = processpca(X,maxfrac) takes X and an optional parameter,

X

N-by-Q matrix

maxfrac

Maximum fraction of variance for removed rows (default is 0)

and returns

Y

M-by-Q matrix with N - M rows deleted

PS

Process settings that allow consistent processing of values

[Y,PS] = processpca(X,FP) takes parameters as a struct: FP.maxfrac.

Y = processpca('apply',X,PS) returns Y, given X and settings PS.

X = processpca('reverse',Y,PS) returns X, given Y and settings PS.

name = processpca('name') returns the name of this process method.

fp = processpca('pdefaults') returns default process parameter structure.

names = processpca('pdesc') returns the process parameter descriptions.

processpca('pcheck',fp); throws an error if any parameter is illegal.

Examples

Here is how to format a matrix with an independent row, a correlated row, and a completely redundant row so that its rows are uncorrelated and the redundant row is dropped.

x1_independent = rand(1,5)
x1_correlated = rand(1,5) + x1_independent;
x1_redundant = x1_independent + x1_correlated
x1 = [x1_independent; x1_correlated; x1_redundant]
[y1,ps] = processpca(x1)

Next, apply the same processing settings to new values.

x2_independent = rand(1,5)
x2_correlated = rand(1,5) + x1_independent;
x2_redundant = x1_independent + x1_correlated
x2 = [x2_independent; x2_correlated; x2_redundant];
y2 = processpca('apply',x2,ps)

Reverse the processing of y1 to get x1 again.

x1_again = processpca('reverse',y1,ps)

More About

collapse all

Algorithms

Values in rows whose elements are not all the same value are set to

y = 2*(x-minx)/(maxx-minx) - 1;

Values in rows with all the same value are set to 0.

Version History

Introduced in R2006a