[GRASS-dev] [GRASS GIS] #576: i.pca fails to center data prior to analysis
GRASS GIS
trac at osgeo.org
Mon May 19 06:59:55 PDT 2014
#576: i.pca fails to center data prior to analysis
--------------------------+-------------------------------------------------
Reporter: nikos | Owner: grass-dev@…
Type: defect | Status: closed
Priority: normal | Milestone: 6.4.4
Component: Raster | Version: svn-develbranch6
Resolution: fixed | Keywords: i.pca, data centering, prcomp(), R, eigenvectors
Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by nikos):
* status: new => closed
* resolution: => fixed
Comment:
I confirm that this works fine now (GRASS 6.4.4svn (2014) / Revision:
50937), ie:
`i.pca input=mod07_b2,mod07_b6,mod07_b7 rescale=0,0 out=pca_mod_b267_2014`
gives
{{{
PC1 778244.03 (-0.4372,-0.7210,-0.5376) [79.20%]
PC2 192494.58 (-0.8310, 0.0953, 0.5481) [19.59%]
PC3 11876.45 ( 0.3439,-0.6863, 0.6408) [ 1.21%]
}}}
which is essentially identical to R's equivalent action via
`prcomp(mod07_b267, center=TRUE, scale=FALSE)`
which in turn gives
{{{
Standard deviations:
[1] 882.1814 438.7420 108.9791
Rotation:
PC1 PC2 PC3
mod07_b2 0.4372107 0.83099407 -0.3439413
mod07_b6 0.7210155 -0.09527873 0.6863371
mod07_b7 0.5375718 -0.54806096 -0.6408165
}}}
Just for clarity/completeness, R reports: 1) column-wise and b) the
"square roots of the eigenvalues", which in this case match GRASS' i.pca
reported eigenvalues. Some R code:
{{{
> ev <- c ( 778244.03, 192494.58, 11876.45) # GRASS-reported eigenvalues
> sapply(ev, sqrt)
[1] 882.1814 438.7420 108.9791
}}}
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/576#comment:4>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list