[GRASS-SVN] r71235 - grass/trunk/raster/r.regression.multi

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jun 29 13:53:09 PDT 2017


Author: mmetz
Date: 2017-06-29 13:53:09 -0700 (Thu, 29 Jun 2017)
New Revision: 71235

Modified:
   grass/trunk/raster/r.regression.multi/main.c
Log:
r.regression.multi: +RMSE, MAE

Modified: grass/trunk/raster/r.regression.multi/main.c
===================================================================
--- grass/trunk/raster/r.regression.multi/main.c	2017-06-27 09:36:23 UTC (rev 71234)
+++ grass/trunk/raster/r.regression.multi/main.c	2017-06-29 20:53:09 UTC (rev 71235)
@@ -111,6 +111,7 @@
     double SE;
     double meanYest, meanYres, varYest, varYres, sdYest, sdYres;
     double SStot, SSerr, SSreg;
+    double SAE;
     double **a;
     struct MATRIX *m, *m_all;
     double **B, Rsq, Rsqadj, F, t, AIC, AICc, BIC;
@@ -365,6 +366,7 @@
 
     meanY = sumY / count;
     SStot = SSerr = SSreg = 0.0;
+    SAE = 0.0;
     for (r = 0; r < rows; r++) {
 	G_percent(r, rows, 2);
 
@@ -409,6 +411,7 @@
 	    SStot += (mapy_val - meanY) * (mapy_val - meanY);
 	    SSreg += (yest - meanY) * (yest - meanY);
 	    SSerr += yres * yres;
+	    SAE += fabs(yres);
 
 	    for (k = 1; k <= n_predictors; k++) {
 		double yesti = 0.0;
@@ -444,6 +447,10 @@
     /* adjusted coefficient of determination */
     Rsqadj = 1 - ((SSerr * (count - 1)) / (SStot * (count - n_predictors - 1)));
     fprintf(stdout, "Rsqadj=%f\n", Rsqadj);
+    /* RMSE */
+    fprintf(stdout, "RMSE=%f\n", sqrt(SSerr / count));
+    /* MAE */
+    fprintf(stdout, "MAE=%f\n", SAE / count);
     /* F statistic */
     /* F = ((SStot - SSerr) / (n_predictors)) / (SSerr / (count - n_predictors));
      * , or: */



More information about the grass-commit mailing list