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

Nikos Alexandris nik at nikosalexandris.net
Wed Dec 4 07:18:34 PST 2013


Moritz Lennert wrote:
> Which components are used ? IIUC, in both cases it will be PCs 1 and 2 as
> PC1 < 70% and PC1 + PC2 > 90%

Absolutely true (see previous post, I didn't cc you :().  Yet, consider the 
following cases (just to justify why I started this thread):

1) Centered and Scaled with:

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%]

here: 69.53 + 26.99 = 96.52

1.1) Get only the 1st

i.pca in=Blue_DNs,Green_DNs,Red_DNs,NIR_DNs out=PC70N -f -n percent=70 --o

> r.info -r PC70N.1
min=171.596979136065
max=1107.42672094831

> r.info -r PC70N.2
min=180.569566126261
max=1871.35099616711


1.2) Just above the 1st+2nd, setting p=96.53 > 96.52

i.pca in=Blue_DNs,Green_DNs,Red_DNs,NIR_DNs out=PC9653N -f -n percent=96.53 --
o
>r.info -r PC9653N.1
min=171.596979136065
max=1107.42672094831

> r.info -r PC9653N.2
min=180.569566126261
max=1871.35099616711

Why same results here?

1.3) Clearly above 1st + 2nd, setting p=97 > 96.52

i.pca in=Blue_DNs,Green_DNs,Red_DNs,NIR_DNs out=PC97N -f -n percent=97 --o

> r.info -r PC97N.1
min=170.679128221915
max=1090.28043417784

> r.info -r PC97N.2
min=172.894850271274
max=1849.10208527211

The "percent=96.53" gets rounded I guess or so... ? I think in one of my tests 
I got confused due to this.

and 2) Centered only

PC1 142403.37 ( 0.0058,-0.0899,-0.0817,-0.9926) [93.76%]
PC2   8979.58 ( 0.4285, 0.7402, 0.5071,-0.1062) [ 5.91%]
PC3    416.51 (-0.3800,-0.3668, 0.8483,-0.0388) [ 0.27%]
PC4     88.39 (-0.8197, 0.5563,-0.1287,-0.0446) [ 0.06%]

here: 93.76 + 5.91 = 99.67

2.1) 1st

>r.info -r PC94N.1
min=171.596979136065                                                                                                                                                                                                                
max=1107.42672094831                                                                                                                                                                                                                

> r.info -r PC94N.2
min=180.569566126261                                                                                                                                                                                                                
max=1871.35099616711                                                                                                                                                                                                                

> r.info -r PC9968.1
min=167.116641509957                                                                                                                                                                                                                
max=1063.871704546                                                                                                                                                                                                                  

> r.info -r PC9968.2
min=180.695102005218
max=1831.85035336866

Here, immediate effect when percent=99.68.  I guess it gets rounded to 99.7 ?

Nikos


More information about the grass-dev mailing list