1r.covar(1)                    Grass User's Manual                   r.covar(1)
2
3
4

NAME

6       r.covar   -  Outputs a covariance/correlation matrix for user-specified
7       raster map layer(s).
8

KEYWORDS

10       raster
11

SYNOPSIS

13       r.covar
14       r.covar help
15       r.covar [-rq] map=name[,name,...]  [--verbose]  [--quiet]
16
17   Flags:
18       -r
19           Print correlation matrix
20
21       -q
22           Run quietly
23
24       --verbose
25           Verbose module output
26
27       --quiet
28           Quiet module output
29
30   Parameters:
31       map=name[,name,...]
32           Name of input raster map(s)
33

DESCRIPTION

35       r.covar outputs  a  covariance/correlation  matrix  for  user-specified
36       raster  map layer(s).  The output can be printed, or saved by redirect‐
37       ing output into a file.
38
39       The output is an N x N symmetric covariance (correlation) matrix, where
40       N is the number of raster map layers specified on the command line.
41

NOTES

43       This  module  can  be  used as the first step of a principle components
44       transformation.  The covariance matrix would be  input  into  a  system
45       which  determines  eigen  values  and  eigen vectors. An NxN covariance
46       matrix would result in N real eigen values and N  eigen  vectors  (each
47       composed of N real numbers).
48
49       The  module  m.eigensystem  in  src.contrib can be compiled and used to
50       generate the eigen values and vectors.
51

EXAMPLE

53       For example, r.covar map=layer.1,layer.2,layer.3
54
55       would produce a 3x3 matrix (values are example only):
56            1.000000  0.914922  0.889581
57            0.914922  1.000000  0.939452
58            0.889581  0.939452  1.000000
59        In the above example, the eigen values and corresponding eigen vectors
60       for the covariance matrix are:
61       component   eigen value               eigen vector
62           1       1159.745202   < 0.691002    0.720528    0.480511 >
63           2          5.970541   < 0.711939   -0.635820   -0.070394 >
64           3        146.503197   < 0.226584    0.347470   -0.846873 >
65         The  component  corresponding  to  each  vector can be produced using
66       r.mapcalc  as   follows:   r.mapcalc   'pc.1   =   0.691002*layer.1   +
67       0.720528*layer.2 + 0.480511*layer.3'
68       r.mapcalc    'pc.2    =    0.711939*layer.1    -   0.635820*layer.2   -
69       0.070394*layer.3'
70       r.mapcalc   'pc.3   =    0.226584*layer.1    +    0.347470*layer.2    -
71       0.846873*layer.3'
72
73       Note  that  based  on the relative sizes of the eigen values, pc.1 will
74       contain about 88% of the variance in the data set,  pc.2  will  contain
75       about  1%  of the variance in the data set, and pc.3 will contain about
76       11% of the variance in the data set.  Also, note that the range of val‐
77       ues  produced in pc.1, pc.2, and pc.3 will not (in general) be the same
78       as those for layer.1, layer.2, and layer.3.  It  may  be  necessary  to
79       rescale  pc.1,  pc.2  and pc.3 to the desired range (e.g. 0-255).  This
80       can be done with r.rescale.
81

SEE ALSO

83       i.pca, m.eigensystem, r.mapcalc, r.rescale
84

AUTHOR

86       Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
87
88       Last changed: $Date: 2008-01-16 19:36:50 +0100 (Wed, 16 Jan 2008) $
89
90       Full index
91
92       © 2003-2008 GRASS Development Team
93
94
95
96GRASS 6.3.0                                                         r.covar(1)
Impressum