[GRASS-user] r.regression.line... differences with regression function LINEST in openoffice.org-calc (?)

nikos.alexandris at felis.uni-freiburg.de nikos.alexandris at felis.uni-freiburg.de
Tue Dec 4 22:00:38 EST 2007


I have submitted some comments upon the documentation of
the "r.regression.line" script in
http://wald.intevation.org/tracker/?func=detail&aid=552&group_id=21&atid=207

Now I have 2 questions.

Apologies if I miss some obvious things but I am confused!

Here it goes:

1. I don't understand why (in lines 84 and 85 in the
r.regression.line script) "sumsqX=sumsqX/tot" and
"sumsqY=sumsqY/tot" ?

2. I can't understand the differences in the following... :
I created two raster maps with the same MASK, each
containing only 6 pixels with the following values:

mapA: 326 641 1336 2020 3197 3484
mapB: 432 850  931 1956 2582 2622

For mapA "r.univar" gives:
n: 6
minimum: 326
maximum: 3484
range: 3158
mean: 1834
mean of absolute values: 1834
standard deviation: 1194.44
variance: 1.4267e+06
variation coefficient: 65.1278 %
sum: 11004)

For mapB... :
n: 6
minimum: 432
maximum: 2622
range: 2190
mean: 1562.17
mean of absolute values: 1562.17
standard deviation: 866.145
variance: 750207
variation coefficient: 55.4451 %
sum: 9373)

In openoffice calc (some of) the respective results are:

For mapA:
MIN: 326
MAX: 3484
AVERAGE: 1834
STDEV: 1308,45
VAR: 1,71E+06
SUM: 11004

For mapB:
MIN: 432
MAX: 2622
AVERAGE: 156217
STDEV: 948,81
VAR: 9,00E+05
SUM: 9373


Based on r.regression.line I get

for map1=mapA and map2=mapB:

a  b  R  N  F medX  sdX  medY  sdY
0.000458151 0.809242 0.99157 1021726 -0.98321 0.01077
5.3038 0.00917369 4.32854

and

for map1=mapB and map2=mapB:
a  b  R  N  F medX  sdX  medY  sdY
-0.000375823 1.21498 0.99157 1021726 -0.98321 0.00917369
4.32854 0.01077 5.3038

"R" is Pearson's correlation coefficient (as correctly
defined in the script "r.regression.line" in line 83 but
wrongly expressed as "sumXY - sumX*sumY/tot" in the
print-out in line 101).

In openoffice-calc I get for these:
MapA    MapB
326	432	1,350792		Slope m	
641	850	0,138835		standard error of the slope	
1336	931	0,959458		RSQ (Square of "r")
2020	1956	94,662802	4,000000	F value from the variance
analysis    std error of regression for Y
3197	2582	8213134,001379		sum of squared deviation of
estimated Y values from their linear mean	
3484	2622				

or

MapB    MapB
432	326	0,710293		Slope m	
850	641	0,073004		standard error of the slope	
931	1336	0,959458		RSQ	
1956	2020	94,662802	4,000000	F value from the variance
analysis    std error of regression for Y
2582	3197	4318750,949062		sum of squared deviation of
estimated Y values from their linear mean	
2622	3484


(How is really r.regression.line functioning? Trying to
interpret the script is not that easy for me since I lack
of some basics in scripting)


Thank you,

Nikos.


More information about the grass-user mailing list