1r.regression.line(1)        GRASS GIS User's Manual       r.regression.line(1)
2
3
4

NAME

6       r.regression.line  - Calculates linear regression from two raster maps:
7       y = a + b*x.
8

KEYWORDS

10       raster, statistics, regression
11

SYNOPSIS

13       r.regression.line
14       r.regression.line --help
15       r.regression.line [-g] mapx=name  mapy=name   [output=name]    [--over‐
16       write]  [--help]  [--verbose]  [--quiet]  [--ui]
17
18   Flags:
19       -g
20           Print in shell script style
21
22       --overwrite
23           Allow output files to overwrite existing files
24
25       --help
26           Print usage summary
27
28       --verbose
29           Verbose module output
30
31       --quiet
32           Quiet module output
33
34       --ui
35           Force launching GUI dialog
36
37   Parameters:
38       mapx=name [required]
39           Map for x coefficient
40
41       mapy=name [required]
42           Map for y coefficient
43
44       output=name
45           ASCII file for storing regression coefficients (output to screen if
46           file not specified).
47

DESCRIPTION

49       r.regression.line calculates a linear regression from two raster  maps,
50       according to the formula
51       y = a + b*x
52       where
53       x
54       y
55       represent the input raster maps.
56
57       Optionally,  it saves regression coefficients as a ASCII file.  The re‐
58       sult includes the  following  coefficients:  offset/intercept  (a)  and
59       gain/slope  (b),  correlation  coefficient (R), number of elements (N),
60       means (medX, medY), standard deviations (sdX, sdY), and the F test  for
61       testing the significance of the regression model as a whole (F).
62

NOTES

64       The  results  for offset/intercept (a) and gain/slope (b) are identical
65       to that obtained from R-stats’s lm() function.
66

EXAMPLE

68       Comparison of two DEMs (SRTM and NED, both at 30m resolution), provided
69       in the North Carolina sample dataset:
70       g.region raster=elev_srtm_30m -p
71       r.regression.line mapx=elev_ned_30m mapy=elev_srtm_30m
72        y = a + b*x
73          a (Offset): -1.659279
74          b (Gain): 1.043968
75          R (sumXY - sumX*sumY/N): 0.894038
76          N (Number of elements): 225000
77          F (F-test significance): 896093.366283
78          meanX (Mean of map1): 110.307571
79          sdX (Standard deviation of map1): 20.311998
80          meanY (Mean of map2): 113.498292
81          sdY (Standard deviation of map2): 23.718307
82
83       Using  the  script style flag AND eval to make results available in the
84       shell:
85       g.region raster=elev_srtm_30m -p
86       eval `r.regression.line -g mapx=elev_ned_30m mapy=elev_srtm_30m`
87       # print result stored in respective variables
88       echo $a
89       -1.659279
90       echo $b
91       1.043968
92       echo $R
93       0.894038
94

SEE ALSO

96        d.correlate, r.regression.multi, r.stats
97

AUTHORS

99       Dr. Agustin Lobo - alobo at ija.csic.es
100       Updated to GRASS 5.7 Michael Barton, Arizona State University
101       Script style output Markus Neteler
102       Conversion to C module Markus Metz
103

SOURCE CODE

105       Available at: r.regression.line source code (history)
106
107       Accessed: Saturday Jan 21 21:15:05 2023
108
109       Main index | Raster index | Topics index | Keywords index  |  Graphical
110       index | Full index
111
112       © 2003-2023 GRASS Development Team, GRASS GIS 8.2.1 Reference Manual
113
114
115
116GRASS 8.2.1                                               r.regression.line(1)
Impressum