I have added a new flag to r.regression.line since the current
approach wasn't very precise (due to r.stats -c which isn't perfect
for FP maps).

 #calculate regression equation
-r.stats -cnA input=$GIS_OPT_MAP1,$GIS_OPT_MAP2  > "$TMP"
+if [ $GIS_FLAG_S -eq 1 ] ; then
+   # slower but accurate
+   r.stats -n1  input=$GIS_OPT_MAP1,$GIS_OPT_MAP2 | sed 's+$+ 1+g' > "$TMP"
+else
+   # count "identical" pixels
+   r.stats -cnA input=$GIS_OPT_MAP1,$GIS_OPT_MAP2  > "$TMP"
+fi
+

The flag -s select the slower method which writes out all
pixel values individually to the temporary file. The result is then
identical to that obtained from R-stats's lm() function.


Markus
-- 
View this message in context: 
http://www.nabble.com/r.regression.line-fix-proposal-tp14141009p15124457.html
Sent from the Grass - Dev mailing list archive at Nabble.com.

_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to