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,...]
16
17   Flags:
18       -r  Print correlation matrix
19
20       -q  Quiet
21
22   Parameters:
23       map=name[,name,...]
24           Name of input raster map(s)
25

DESCRIPTION

27       r.covar outputs  a  covariance/correlation  matrix  for  user-specified
28       raster  map layer(s).  The output can be printed, or saved by redirect‐
29       ing output into a file.
30
31       The output is an N x N symmetric covariance (correlation) matrix, where
32       N  is  the  number  of raster map layers specified on the command line.
33       For example, r.covar map=layer.1,layer.2,layer.3
34
35       would produce a 3x3 matrix (values are example only):
36            1.000000  0.914922  0.889581
37            0.914922  1.000000  0.939452
38            0.889581  0.939452  1.000000
39
40

PRINCIPLE COMPONENTS

42       This module can be used as the first step  of  a  principle  components
43       transformation.   The  covariance  matrix  would be input into a system
44       which determines eigen values and  eigen  vectors.  An  NxN  covariance
45       matrix  would  result  in N real eigen values and N eigen vectors (each
46       composed of N real numbers).  In the above example,  the  eigen  values
47       and corresponding eigen vectors for the covariance matrix are:
48       component   eigen value               eigen vector
49           1       1159.745202   < 0.691002    0.720528    0.480511 >
50           2          5.970541   < 0.711939   -0.635820   -0.070394 >
51           3        146.503197   < 0.226584    0.347470   -0.846873 >
52         The  component  corresponding  to  each  vector can be produced using
53       r.mapcalc  as   follows:   r.mapcalc   'pc.1   =   0.691002*layer.1   +
54       0.720528*layer.2 + 0.480511*layer.3'
55       r.mapcalc    'pc.2    =    0.711939*layer.1    -   0.635820*layer.2   -
56       0.070394*layer.3'
57       r.mapcalc   'pc.3   =    0.226584*layer.1    +    0.347470*layer.2    -
58       0.846873*layer.3'
59
60       Note  that  based  on the relative sizes of the eigen values, pc.1 will
61       contain about 88% of the variance in the data set,  pc.2  will  contain
62       about  1%  of the variance in the data set, and pc.3 will contain about
63       11% of the variance in the data set.  Also, note that the range of val‐
64       ues  produced in pc.1, pc.2, and pc.3 will not (in general) be the same
65       as those for layer.1, layer.2, and layer.3.  It  may  be  necessary  to
66       rescale  pc.1,  pc.2  and pc.3 to the desired range (e.g. 0-255).  This
67       can be done with r.rescale.
68

NOTES

70       The module m.eigensystem in src.contrib can be  compiled  and  used  to
71       generate the eigen values and vectors.
72

SEE ALSO

74       i.pca, m.eigensystem, r.mapcalc, r.rescale
75

AUTHOR

77       Michael Shapiro, U.S. Army Construction Engineering Research Laboratory
78
79       Last changed: $Date: 2003/05/06 12:57:35 $
80
81       Full index
82
83
84
85GRASS 6.2.2                                                         r.covar(1)
Impressum