# [GRASS-dev] PCA (i.pca) in G7: filtering and rescaling

Moritz Lennert mlennert at club.worldonline.be
Wed Dec 4 06:16:16 PST 2013

```On 04/12/13 14:53, Nikos Alexandris wrote:
> Hi list and Markus.
>
> The i.pca module in G7 offers a "forward/filtering/backward" PCA.  I have an
> issue first with filtering and second with rescaling.
>
>
> 1) I can't see any differences in the derived Principal Components between
> percent=70 and percent=99 for 4 bands which the PCs (both centered and scaled)
> are:
>
> PC1      2.78 ( 0.4947, 0.5922, 0.5743, 0.2735) [69.53%]
> PC2      1.08 ( 0.5196, 0.0517,-0.0974,-0.8473) [26.99%]
> PC3      0.11 ( 0.4210, 0.2486,-0.7926, 0.3644) [ 2.86%]
> PC4      0.03 (-0.5551, 0.7647,-0.1805,-0.2729) [ 0.63%]
>
> What is filtering doing actually?  Shouldn't percent=70 just filter out the
> rest, somehow?

AFAIU, filtering happens after pca: pca is run on all bands, then
according to the filter percentage you chose inverse pca is run using
the principal components necessary to reach the filter percentage of
variance. In your example, 70% would use PC1 and 2 (unless variances is
rounded up) and 99% would use PC1,2,3. Any difference you see is in the
resulting images, not in the PCA.

Example with the Landsat bands in the NC data set (group landsat = all
mx bands):

i.pca -f input=landsat output_prefix=filt percent=90

Computing covariance matrix...
Using 2 of 6 principal components for filtering
^^^^

=> For the inverse PCA, only 2 components are used since PC1+PC2>90%

However the info given is about the entire PCA:

Calculating principal components...
Eigen values, (vectors), and [percent importance]:
PC1   4334.35 ( 0.2824, 0.3342, 0.5092,-0.0087, 0.5264, 0.5217) [83.04%]
PC2    588.31 ( 0.2541, 0.1885, 0.2923,-0.7428,-0.5110,-0.0403) [11.27%]
PC3    239.22 ( 0.3801, 0.3819, 0.2681, 0.6238,-0.4000,-0.2980) [ 4.58%]
PC4     32.85 ( 0.1752,-0.0191,-0.4053, 0.1593,-0.4435, 0.7632) [ 0.63%]
PC5     20.73 (-0.6170,-0.2514, 0.6059, 0.1734,-0.3235, 0.2330) [ 0.40%]
PC6      4.08 (-0.5475, 0.8021,-0.2282,-0.0607,-0.0208, 0.0252) [ 0.08%]

Moritz
```