Merge commit 'origin/stable'
[pspp-builds.git] / src / language / stats / regression.q
index 14d4b841a478614b4d72d92481ade1d16be02be4..41a23f3e2580ebd9a9aac6ff289b89803c6f8da2 100644 (file)
@@ -315,9 +315,9 @@ reg_stats_anova (pspp_linreg_cache * c)
 
 
   /* Degrees of freedom */
-  tab_text (t, 3, 1, TAB_RIGHT | TAT_PRINTF, "%g", c->dfm);
-  tab_text (t, 3, 2, TAB_RIGHT | TAT_PRINTF, "%g", c->dfe);
-  tab_text (t, 3, 3, TAB_RIGHT | TAT_PRINTF, "%g", c->dft);
+  tab_text_format (t, 3, 1, TAB_RIGHT, "%g", c->dfm);
+  tab_text_format (t, 3, 2, TAB_RIGHT, "%g", c->dfe);
+  tab_text_format (t, 3, 3, TAB_RIGHT, "%g", c->dft);
 
   /* Mean Squares */
   tab_double (t, 4, 1, TAB_RIGHT, msm, NULL);
@@ -914,7 +914,7 @@ run_regression (struct casereader *input, struct cmd_regression *cmd,
     }
   lopts.get_depvar_mean_std = 1;
 
-  lopts.get_indep_mean_std = xnmalloc (n_variables, sizeof (int));
+
   indep_vars = xnmalloc (n_variables, sizeof *indep_vars);
 
   for (k = 0; k < cmd->n_dependent; k++)
@@ -942,6 +942,7 @@ run_regression (struct casereader *input, struct cmd_regression *cmd,
            design_matrix_create (n_indep,
                                  (const struct variable **) indep_vars,
                                  n_data);
+         lopts.get_indep_mean_std = xnmalloc (X->m->size2, sizeof (int));
          for (i = 0; i < X->m->size2; i++)
            {
              lopts.get_indep_mean_std[i] = 1;
@@ -993,6 +994,7 @@ run_regression (struct casereader *input, struct cmd_regression *cmd,
 
          gsl_vector_free (Y);
          design_matrix_destroy (X);
+         free (lopts.get_indep_mean_std);
        }
       else
        {
@@ -1007,7 +1009,6 @@ run_regression (struct casereader *input, struct cmd_regression *cmd,
     }
   free (mom);
   free (indep_vars);
-  free (lopts.get_indep_mean_std);
   casereader_destroy (input);
 
   return true;