pspp-cvs
[Top][All Lists]
Advanced

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

[Pspp-cvs] pspp/src/language/stats regression.q ChangeLog


From: Jason H Stover
Subject: [Pspp-cvs] pspp/src/language/stats regression.q ChangeLog
Date: Tue, 08 May 2007 14:55:58 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Changes by:     Jason H Stover <jstover>        07/05/08 14:55:57

Modified files:
        src/language/stats: regression.q ChangeLog 

Log message:
        partial fix of bug 19819

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/regression.q?cvsroot=pspp&r1=1.50&r2=1.51
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/ChangeLog?cvsroot=pspp&r1=1.50&r2=1.51

Patches:
Index: regression.q
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/regression.q,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- regression.q        22 Apr 2007 00:48:50 -0000      1.50
+++ regression.q        8 May 2007 14:55:57 -0000       1.51
@@ -1066,7 +1066,7 @@
        }
       i++;
     }
-  return result;
+  return (result == 0) ? 1 : result;
 }
 
 /*
@@ -1087,7 +1087,12 @@
   j = 0;
   for (i = 0; i < n_variables; i++)
     {
-      if (!is_depvar (i, depvar))
+      /*
+       The second condition ensures the program will run even if
+       there is only one variable to act as both explanatory and
+       response.
+       */
+      if ((!is_depvar (i, depvar)) || (n_variables == 1))
        {
          indep_vars[j] = v_variables[i];
          j++;
@@ -1221,11 +1226,12 @@
       n_data = prepare_data (n_cases, is_missing_case, indep_vars,
                             cmd.v_dependent[k],
                             (const struct casefile *) cf, mom);
-      if (n_data > 0)
+      if ((n_data > 0) && (n_indep > 0))
        {
          Y = gsl_vector_alloc (n_data);
          X =
-           design_matrix_create (n_indep, (const struct variable **) 
indep_vars,
+           design_matrix_create (n_indep,
+                                 (const struct variable **) indep_vars,
                                  n_data);
          for (i = 0; i < X->m->size2; i++)
            {
@@ -1273,12 +1279,13 @@
                          if (var_is_alpha (v_variables[i]))
                            {
                              design_matrix_set_categorical (X, row,
-                                                            v_variables[i], 
val);
+                                                            v_variables[i],
+                                                            val);
                            }
                          else
                            {
-                             design_matrix_set_numeric (X, row, v_variables[i],
-                                                        val);
+                             design_matrix_set_numeric (X, row,
+                                                        v_variables[i], val);
                            }
                        }
                    }

Index: ChangeLog
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/ChangeLog,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- ChangeLog   16 Apr 2007 10:49:32 -0000      1.50
+++ ChangeLog   8 May 2007 14:55:57 -0000       1.51
@@ -1,3 +1,8 @@
+2007-05-08  Jason Stover  <address@hidden>
+
+       * regression.q: Partial fix of bug which caused a crash if
+       dependent variable and independent variable were the same.
+
 2007-04-16 John Darrington <address@hidden>
 
        * t-test.q: Changed the output width of reported counts and 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]