[GRASS-dev] Reg i.pca output

Markus Metz markus.metz.giswork at gmail.com
Tue Mar 26 07:10:33 PDT 2013


On Tue, Mar 26, 2013 at 1:21 PM, Rashad M <mohammedrashadkm at gmail.com> wrote:
> It seems like values are different using the forumla. I can provide a test
> case if you need
>
>
>
> i tried this:
> i.pca in=lsat7_2000_10,lsat7_2000_20 out=mypca
>
> Rescaling to range 0,255...
>  100%
> Eigen values, (vectors), and [percent importance]:
> PC1    436.48 ( 0.6640, 0.7477) [98.84%]
> PC2      5.13 (-0.7477, 0.6640) [ 1.16%]
>
>
> here only first column of eigen vector is important right?
>
> But let me ask does eigen values and percent of importance doesnt have any
> role?
>
> here when running the above i.pca i get mypca.1 and mypca.2
> P1 and P2 are first pixel row=0, col=0 of mypca.1 and mypca.2 respectively
> and mean is the mean of lsat7_2000_10
>
> output is the output obtained from the equation --> (X = P * eigenvector(P,
> X) + P * eigenvector(Q, X) + mean(B1) )
>
> and input is the pixel value of lsat7_2000_10 @ row=0, col=0
>
>
> P1=  21
> P2=  112
> mean=    79.925
> output=  138.4471
> input=   72
>
> Any thoughts?

You need to disable rescaling of the PC scores with i.pca rescale=0,0

Markus M

>
>
> On Tue, Mar 26, 2013 at 4:54 PM, Markus Metz <markus.metz.giswork at gmail.com>
> wrote:
>>
>> On Tue, Mar 26, 2013 at 12:10 PM, Rashad M <mohammedrashadkm at gmail.com>
>> wrote:
>> >
>> >
>> >
>> > On Tue, Mar 26, 2013 at 3:58 PM, Markus Metz
>> > <markus.metz.giswork at gmail.com>
>> > wrote:
>> >>
>> >> On Tue, Mar 26, 2013 at 10:25 AM, Rashad M <mohammedrashadkm at gmail.com>
>> >> wrote:
>> >> >
>> >> >
>> >> >
>> >> > On Tue, Mar 26, 2013 at 2:44 PM, Markus Metz
>> >> > <markus.metz.giswork at gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> On Tue, Mar 26, 2013 at 8:39 AM, Rashad M
>> >> >> <mohammedrashadkm at gmail.com>
>> >> >> wrote:
>> >> >> > Hi,
>> >> >> >
>> >> >> > i.pca creates 6 raster maps for 6 input raster
>> >> >> >
>> >> >> > eg:
>> >> >> >
>> >> >> > i.pca
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > in=lsat7_2002_10,lsat7_2002_20,lsat7_2002_30,lsat7_2002_40,lsat7_2002_50,lsat7_2002_70
>> >> >> > \
>> >> >> >     out=lsat7_2002_pca
>> >> >> >
>> >> >> >
>> >> >> > I have a doubt here
>> >> >> >
>> >> >> > Does the output lsat7_2002_pca.1 is the corresponding map for
>> >> >> > lsat7_2002_10?
>> >> >>
>> >> >> No. lsat7_2002_pca.1 contains the principal component with the
>> >> >> highest
>> >> >> eigenvalue and is calculated using all input bands. More generally,
>> >> >> each lsat7_2002_pca.* map is calculated using all input bands. Look
>> >> >> at
>> >> >> the eigenvectors to find out the weights with which each input map
>> >> >> contributes to a specific PCA.
>> >> >>
>> >> >
>> >> > So by knowing a pixel value of lsat7_2002_pca.1 can I get the value
>> >> > before
>> >> > transformation in PCA.
>> >> > consider this:
>> >> > I have two bands B1,B2 and after i.pca I get PC1,PC2. Then is there a
>> >> > way to
>> >> > derive value of X,Y where X belongs to B1 and Y belongs to B2 by only
>> >> > knowing P,Q
>> >> > where P belongs to PC1 and Q belongs to PC2
>> >> >
>> >> > and also X,Y and P,Q are of same index (row,col)
>> >>
>> >> X = P * eigenvector(P, X) + P * eigenvector(Q, X) + mean(B1)
>> >>
>> >> Using the example from the manual:
>> >>
>> >> X = 0.2824 * PC1 + 0.2541 * PC2 + 0.3801 * PC3 +  0.1752 * PC4 -
>> >> 0.6170 * PC5 - 0.5475 * PC6 + mean(band 1)
>> >
>> >
>> > Thanks.
>> >
>> > just a small clarification:
>> > PC1 is the pixel value at (i,j) of output band  pca.1 and X is the pixel
>> > value at (i,j) of input band b1
>> >
>> > This is correct?
>>
>> yes
>>
>> >
>> >>
>> >> Markus M
>> >>
>> >> >
>> >> > I hope this is clear
>> >> >
>> >> >>
>> >> >> Markus M
>> >> >>
>> >> >> >
>> >> >> > If so the lsat7_2002_10_pca.1 contains PCA transformed pixel for
>> >> >> > lsat7_2002_10
>> >> >> >
>> >> >> > Is this correct?
>> >> >> >
>> >> >> > --
>> >> >> > Regards,
>> >> >> >    Rashad
>> >> >> >
>> >> >> > _______________________________________________
>> >> >> > grass-dev mailing list
>> >> >> > grass-dev at lists.osgeo.org
>> >> >> > http://lists.osgeo.org/mailman/listinfo/grass-dev
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Regards,
>> >> >    Rashad
>> >
>> >
>> >
>> >
>> > --
>> > Regards,
>> >    Rashad
>
>
>
>
> --
> Regards,
>    Rashad


More information about the grass-dev mailing list