r.regression.line.1 3.13 KB
Newer Older
xuebingbing's avatar
xuebingbing committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
.TH r.regression.line 1 "" "GRASS 7.8.2" "Grass User's Manual"
.SH NAME
\fI\fBr.regression.line\fR\fR  \- Calculates linear regression from two raster maps: y = a + b*x.
.SH KEYWORDS
raster, statistics, regression
.SH SYNOPSIS
\fBr.regression.line\fR
.br
\fBr.regression.line \-\-help\fR
.br
\fBr.regression.line\fR [\-\fBg\fR] \fBmapx\fR=\fIname\fR \fBmapy\fR=\fIname\fR  [\fBoutput\fR=\fIname\fR]   [\-\-\fBoverwrite\fR]  [\-\-\fBhelp\fR]  [\-\-\fBverbose\fR]  [\-\-\fBquiet\fR]  [\-\-\fBui\fR]
.SS Flags:
.IP "\fB\-g\fR" 4m
.br
Print in shell script style
.IP "\fB\-\-overwrite\fR" 4m
.br
Allow output files to overwrite existing files
.IP "\fB\-\-help\fR" 4m
.br
Print usage summary
.IP "\fB\-\-verbose\fR" 4m
.br
Verbose module output
.IP "\fB\-\-quiet\fR" 4m
.br
Quiet module output
.IP "\fB\-\-ui\fR" 4m
.br
Force launching GUI dialog
.SS Parameters:
.IP "\fBmapx\fR=\fIname\fR \fB[required]\fR" 4m
.br
Map for x coefficient
.IP "\fBmapy\fR=\fIname\fR \fB[required]\fR" 4m
.br
Map for y coefficient
.IP "\fBoutput\fR=\fIname\fR" 4m
.br
ASCII file for storing regression coefficients (output to screen if file not specified).
.SH DESCRIPTION
\fIr.regression.line\fR calculates a linear regression from two
raster maps, according to the formula
.br
.nf
\fC
y = a + b*x
\fR
.fi
where
.br
.nf
\fC
x
y
\fR
.fi
represent the input raster maps.
.PP
Optionally, it saves regression coefficients as a ASCII file.
The result includes the following coefficients:
offset/intercept (a) and gain/slope (b), correlation coefficient (R),
number of elements (N), means (medX, medY), standard deviations
(sdX, sdY), and the F test for testing the significance of the
regression model as a whole (F).
.SH NOTES
The results for offset/intercept (a) and gain/slope (b) are
identical to that obtained from R\-stats\(cqs lm() function.
.SH EXAMPLE
Comparison of two DEMs (SRTM and NED, both at 30m resolution),
provided in the North Carolina sample dataset:
.br
.nf
\fC
g.region raster=elev_srtm_30m \-p
r.regression.line mapx=elev_ned_30m mapy=elev_srtm_30m
 y = a + b*x
   a (Offset): \-1.659279
   b (Gain): 1.043968
   R (sumXY \- sumX*sumY/N): 0.894038
   N (Number of elements): 225000
   F (F\-test significance): 896093.366283
   meanX (Mean of map1): 110.307571
   sdX (Standard deviation of map1): 20.311998
   meanY (Mean of map2): 113.498292
   sdY (Standard deviation of map2): 23.718307
\fR
.fi
.PP
Using the script style flag AND \fIeval\fR to make results
available in the shell:
.br
.nf
\fC
g.region raster=elev_srtm_30m \-p
eval \(gar.regression.line \-g mapx=elev_ned_30m mapy=elev_srtm_30m\(ga
# print result stored in respective variables
echo $a
\-1.659279
echo $b
1.043968
echo $R
0.894038
\fR
.fi
.SH SEE ALSO
\fI
d.correlate,
r.regression.multi,
r.stats
\fR
.SH AUTHORS
Dr. Agustin Lobo \- alobo at ija.csic.es
.br
Updated to GRASS 5.7 Michael Barton, Arizona State University
.br
Script style output Markus Neteler
.br
Conversion to C module Markus Metz
.SH SOURCE CODE
.PP
Available at: r.regression.line source code (history)
.PP
Main index |
Raster index |
Topics index |
Keywords index |
Graphical index |
Full index
.PP
© 2003\-2019
GRASS Development Team,
GRASS GIS 7.8.2 Reference Manual