if (NULL == beta_hat)
return false;
+
+ for (i = 0; i < cmd->n_cat_predictors; ++i)
+ {
+ if (1 >= categoricals_n_count (work.cats, i))
+ {
+ struct string str;
+ ds_init_empty (&str);
+
+ interaction_to_string (cmd->cat_predictors[i], &str);
+
+ msg (ME, _("Category %s does not have at least two distinct values. Logistic regression will not be run."),
+ ds_cstr(&str));
+ ds_destroy (&str);
+ return false;
+ }
+ }
+
output_depvarmap (cmd, &work);
case_processing_summary (&work);
-
AT_BANNER([LOGISTIC REGRESSION])
dnl These examples are adapted from
])
AT_CLEANUP
+
+
+dnl Check that it doesn't crash if a categorical variable
+dnl has only one distinct value
+AT_SETUP([LOGISTIC REGRESSION identical categories])
+
+AT_DATA([crash.sps], [dnl
+data list notable list /y x1 x2*.
+begin data
+0 1 1
+1 2 1
+end data.
+
+logistic regression y with x1 x2
+ /categorical = x2.
+])
+
+AT_CHECK([pspp -O format=csv crash.sps], [1], [ignore])
+
+AT_CLEANUP