[GRASS-user] Calculating eigen values and % variance
explainedafter PCA analysis
Nikos Alexandris
nikos.alexandris at felis.uni-freiburg.de
Wed Feb 25 08:49:50 EST 2009
Nikos:
> If you have success running m.eigensystem, can I please ask you to let
> the list (and me :-p) know about it? I compiled m.eigensystem without
> errors but it doesn't seem to work within from grass65. I am currently
> re-compiling grass6_devel to see whether it will work or not.
>
> Or do I need to work with grass6.4?
# Answering to myself :-p
Yes, it works. I was confused by the fact that nomatter what argument is
given to m.eigensystem it does not print short description/help
messages. Instead it runs. Of course "man m.eigensystem" lets you read
the manual.
So here is an(other) example:
# get covariance matrix
r.covar
map=MOD2006_239_500_sur_refl_b02,MOD2006_239_500_sur_refl_b06,MOD2006_239_500_sur_refl_b07,MOD2007_242_500_sur_refl_b02,MOD2007_242_500_sur_refl_b06,MOD2007_242_500_sur_refl_b07
r.covar: complete ...
100%
230737.894890 195532.919270 135003.507092 160548.524865
157011.283237 109163.152597
195532.919270 370156.630631 302611.016829 169840.571354
329762.496795 255222.040018
135003.507092 302611.016829 269579.148609 123245.319257
267537.923455 218257.721900
160548.524865 169840.571354 123245.319257 283021.657148
227212.808304 97810.797191
157011.283237 329762.496795 267537.923455 227212.808304
411853.700150 306427.271345
109163.152597 255222.040018 218257.721900 97810.797191
306427.271345 287565.577718
# output in a file
r.covar
map=MOD2006_239_500_sur_refl_b02,MOD2006_239_500_sur_refl_b06,MOD2006_239_500_sur_refl_b07,MOD2007_242_500_sur_refl_b02,MOD2007_242_500_sur_refl_b06,MOD2007_242_500_sur_refl_b07 > test_m.eigensystem
# edit the file and add a number K which corresponds to the
number of rows and columns of the cov matrix
# in my example: add the number "6" in the top line of the
test_m.eigensystem file
# run m.eigensystem
m.eigensystem < test_m.eigensystem
E 1384795.0108207434 .0000000000 74.74
V .4835516921 .0000000000
V .8488469532 .0000000000
V .6938880512 .0000000000
V .5233792650 .0000000000
V .8927982533 .0000000000
V .6795723454 .0000000000
N .2806476574 .0000000000
N .4926606871 .0000000000
N .4027243813 .0000000000
N .3037631075 .0000000000
N .5181694995 .0000000000
N .3944157157 .0000000000
W 330.2586235389 .0000000000
W 579.7498611168 .0000000000
W 473.9152326520 .0000000000
W 357.4602642457 .0000000000
W 609.7679463257 .0000000000
W 464.1378182325 .0000000000
E 241514.2792070895 .0000000000 13.03
[...]
More information about the grass-user
mailing list