Skip to main content
. 2019 Feb 21;13:52. doi: 10.3389/fnhum.2019.00052

Algorithm 1.

Principal component analysis (PCA)

Input:    Sample set S(t)=(s(t1), s(t2),,s(tn))T Low dimensional dimension n,
Process:
1: Centralize all samples:
S(ti)S(ti)-1ni=1nS(ti)
2: Calculate the covariance matrix of sample: SST
3: Solving the correlation coefficient matrix
R=(rij)n×n(rij=rji,rii=1)
4: Solving the eigenvalues of the correlation coefficient matrix:
λ1λ2λn0
5: Determine the number of principal components: m
i=1mλi/i=1pλiα, α=80%
6: Calculate the corresponding eigenvector:
x1=(x11x21xp1),x2=(x12x22xp2),,xm=(x1mx2mxpm)
7: Calculate principal components:
Zi=x1iS1+x2iS2++xpiSp
i=(1,2,,m)