I use an SVD package with R, and I can reduce the dimension of my matrix by replacing the smallest singular values with 0. But when I rebuild my matrix, I still have the same number of functions, I might not find how to remove the most useless functions of the original matrix to reduce the number of columns.
For example, what I'm doing at the moment:
This is my original matrix A:
A B C D
1 7 6 1 6
2 4 8 2 4
3 2 3 2 3
4 2 3 1 3
If I do this:
s = svd(A)
s$d[3:4] = 0
A' = s$u %*% diag(s$d) %*% t(s$v)
I get A ', which has the same dimensions (4x4), was reconstructed with only 2 "components", and is an approximation of A (containing a little less information, maybe less noise, etc.):
[,1] [,2] [,3] [,4]
1 6.871009 5.887558 1.1791440 6.215131
2 3.799792 7.779251 2.3862880 4.357163
3 2.289294 3.512959 0.9876354 2.386322
4 2.408818 3.181448 0.8417837 2.406172
, , - , , - ( PCA, A ''):
PC1 PC2
1 -3.588727 1.7125360
2 -2.065012 -2.2465708
3 2.838545 0.1377343
4 2.815194 0.3963005
A '' PCA:
p = prcomp(A)
A'' = p$x[,1:2]
- , .
, - :)