Scroll to navigation

r.regression.line(1grass) Grass User's Manual r.regression.line(1grass)

NAME

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

KEYWORDS

raster, statistics

SYNOPSIS

r.regression.line
 
r.regression.line help
 
r.regression.line [-gs] map1=name map2=name [ output=name] [--verbose] [--quiet]

Flags:

-g
 
Print in shell script style
-s
 
This does nothing. It is retained for backwards compatibility
--verbose
 
Verbose module output
--quiet
 
Quiet module output

Parameters:

map1=name
 
Map for x coefficient
map2=name
 
Map for y coefficient
output=name
 
ASCII file for storing regression coefficients (output to screen if file not specified).

DESCRIPTION

r.regression.line Calculates linear regression from two raster maps, according to the formula y = a + b*x, where x and y represent raster maps. Optionally saves regression coefficients to an 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).

NOTES

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

EXAMPLE

Comparison of the old and the new DEM in Spearfish:
 
g.region rast=elevation.10m -p
 
r.regression.line map1=elevation.dem map2=elevation.10m
 
Using the script style flag AND eval to make results available in the shell:
 
g.region rast=elevation.10m -p
 
eval `r.regression.line -g map1=elevation.dem map2=elevation.10m`
 
echo $a
 
479.615
 
 
echo $b
 
0.645631
 
 
echo $R
 
0.804441
 

AUTHOR

Dr. Agustin Lobo - alobo at ija.csic.es
 
Updated to GRASS 5.7 Michael Barton, Arizona State University
 
Script style output Markus Neteler
 
Conversion to C module Markus Metz
Last changed: $Date: 2013-09-14 04:52:51 +0200 (Sat, 14 Sep 2013) $
Full index
© 2003-2014 GRASS Development Team
GRASS 6.4.4