[gnumeric] regression tool: show internally and externally studentized residuals also for non-affine regression



commit 20b2020eef1a53556d8baefc345c0fc4d04222c9
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Fri Nov 26 18:16:57 2010 -0700

    regression tool: show internally and externally studentized residuals also for non-affine regression
    
    2010-11-26 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* analysis-tools.c (analysis_tool_regression_engine_run): show
    	  internally and externally studentized residuals also for non-affine
    	  regression
    	(analysis_tool_regression_engine): allocate space for studentized
    	  residuals for intercept == 0

 src/tools/ChangeLog        |    8 ++++++++
 src/tools/analysis-tools.c |   27 ++++++++++-----------------
 2 files changed, 18 insertions(+), 17 deletions(-)
---
diff --git a/src/tools/ChangeLog b/src/tools/ChangeLog
index 0ef5376..b33d0fd 100644
--- a/src/tools/ChangeLog
+++ b/src/tools/ChangeLog
@@ -1,6 +1,14 @@
 2010-11-26 Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* analysis-tools.c (analysis_tool_regression_engine_run): show
+	  internally and externally studentized residuals also for non-affine
+	  regression
+	(analysis_tool_regression_engine): allocate space for studentized
+	  residuals for intercept == 0
+
+2010-11-26 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* analysis-tools.c (analysis_tool_regression_engine_run): show
 	  internally and externally studentized residuals
 	(analysis_tool_regression_engine): allocate space for studentized
 	  residuals
diff --git a/src/tools/analysis-tools.c b/src/tools/analysis-tools.c
index 961cc57..a6252f7 100644
--- a/src/tools/analysis-tools.c
+++ b/src/tools/analysis-tools.c
@@ -3292,24 +3292,19 @@ analysis_tool_regression_engine_run (data_analysis_output_t *dao,
 		GnmExpr const *expr_prediction;
 
 		dao->offset_row += xdim + 1;
-		dao_set_italic (dao, 0, 0, info->intercept ? (xdim + 7) : (xdim + 3), 0);
+		dao_set_italic (dao, 0, 0, xdim + 7, 0);
 		dao_set_cell (dao, 0, 0, _("Constant"));
 		dao_set_array_expr (dao, 1, 0, xdim, 1, 
 				    gnm_expr_new_funcall1 
 				    (fd_transpose, 
 				     make_rangeref (-1, - xdim - 1, -1, -2)));
-		if (info->intercept) {
-			set_cell_text_row (dao, xdim + 1, 0, _("/Prediction"
-							       "/"
-							       "/Residual"
-							       "/Leverages"
-							       "/Internally studentized"
-							       "/Externally studentized"
-							       "/p-Value"));
-		} else
-			set_cell_text_row (dao, xdim + 1, 0, _("/Prediction"
-							       "/"
-							       "/Residual"));			
+		set_cell_text_row (dao, xdim + 1, 0, _("/Prediction"
+						       "/"
+						       "/Residual"
+						       "/Leverages"
+						       "/Internally studentized"
+						       "/Externally studentized"
+						       "/p-Value"));
 		dao_set_cell_expr (dao, xdim + 2, 0, make_cellref (1 - xdim, - 18 - xdim));
 		if (info->group_by == GROUPED_BY_ROW) {
 			dao_set_array_expr (dao, 1, 1, xdim, n_obs,
@@ -3343,7 +3338,7 @@ analysis_tool_regression_engine_run (data_analysis_output_t *dao,
 		gnm_expr_free (expr_prediction);
 
 		if (dao_cell_is_visible (dao, xdim + 4, n_obs)) {
-			GnmExpr const *expr_X = dao_get_rangeref (dao, 0, 1, xdim, n_obs);
+			GnmExpr const *expr_X = dao_get_rangeref (dao, info->intercept ? 0 : 1, 1, xdim, n_obs);
 			GnmExpr const *expr_X_t = 
 				gnm_expr_new_funcall1 (fd_transpose, gnm_expr_copy (expr_X));
 			GnmExpr const *expr_X_hat =
@@ -3612,9 +3607,7 @@ analysis_tool_regression_engine (data_analysis_output_t *dao, gpointer specs,
 				GnmValue *val = info->base.range_1;
 
 				rows += 2 + calculate_n_obs (val, info->group_by); 
-				if (info->intercept) {
-					residual_cols += 4;
-				}
+				residual_cols += 4;
 				if (cols < residual_cols)
 					cols = residual_cols;
 			}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]