Logistic Regression: Handle missing categoricals
[pspp] / tests / language / stats / logistic.at
index b4d9eef458a2c736ec93c036cbc6baef48149f9f..9ab04f8cec0045192eba5d1368a8909fb5a6de10 100644 (file)
@@ -1028,3 +1028,139 @@ logistic regression y with x1 x2
 AT_CHECK([pspp -O format=csv crash.sps], [1], [ignore])
 
 AT_CLEANUP
+
+
+dnl Test that missing values on the categorical predictors are treated
+dnl properly.
+AT_SETUP([LOGISTIC REGRESSION missing categoricals])
+
+AT_DATA([data.txt], [dnl
+      .00     3.69      .00 
+      .00     1.16     1.00 
+     1.00   -12.99      .00 
+      .00     2.97     1.00 
+      .00    20.48      .00 
+      .00     4.90      .00 
+     1.00    -4.38      .00 
+      .00    -1.69     1.00 
+     1.00    -5.71      .00 
+     1.00   -14.28      .00 
+      .00     9.00      .00 
+      .00     2.89     1.00 
+      .00    13.51     1.00 
+      .00    23.32     1.00 
+      .00     2.31     1.00 
+      .00    -2.07     1.00 
+     1.00    -4.52     1.00 
+     1.00    -5.83      .00 
+     1.00    -1.91      .00 
+     1.00   -11.12     1.00 
+      .00    -1.51      .00 
+      .00     6.59     1.00 
+      .00    19.28     1.00 
+      .00     5.94      .00 
+      .00     8.21     1.00 
+      .00     8.11     1.00 
+      .00     2.49      .00 
+      .00     9.62      .00 
+     1.00   -20.74     1.00 
+      .00    -1.41     1.00 
+      .00    15.15     1.00 
+      .00     9.39      .00 
+     1.00   -15.14     1.00 
+     1.00    -5.86      .00 
+     1.00   -11.64     1.00 
+     1.00   -14.36      .00 
+     1.00    -8.95     1.00 
+     1.00   -16.42     1.00 
+     1.00    -1.04     1.00 
+      .00    12.89     1.00 
+      .00    -7.08     1.00 
+      .00     4.87     1.00 
+      .00    11.53     1.00 
+     1.00    -6.24     1.00 
+      .00     1.25     1.00 
+      .00     4.39     1.00 
+      .00     3.17      .00 
+      .00    19.39     1.00 
+      .00    13.03     1.00 
+      .00     2.43      .00 
+     1.00   -14.73     1.00 
+      .00     8.25     1.00 
+     1.00   -13.28     1.00 
+      .00     5.27     1.00 
+     1.00    -3.46     1.00 
+      .00    13.81     1.00 
+      .00     1.35     1.00 
+     1.00    -3.94     1.00 
+      .00    20.73     1.00 
+     1.00   -15.40      .00 
+     1.00   -11.01     1.00 
+      .00     4.56      .00 
+     1.00   -15.35     1.00 
+      .00    15.21      .00 
+      .00     5.34     1.00 
+     1.00   -21.55     1.00 
+      .00    10.12     1.00 
+      .00     -.73     1.00 
+      .00    15.28     1.00 
+      .00    11.08     1.00 
+     1.00    -8.24      .00 
+      .00     2.46      .00 
+      .00     9.60      .00 
+      .00    11.24      .00 
+      .00    14.13     1.00 
+      .00    19.72     1.00 
+      .00     5.58      .00 
+      .00    26.23     1.00 
+      .00     7.25      .00 
+     1.00     -.79      .00 
+      .00     6.24      .00 
+     1.00     1.16      .00 
+     1.00    -7.89     1.00 
+     1.00    -1.86     1.00 
+     1.00   -10.80     1.00 
+     1.00    -5.51      .00 
+      .00     7.51      .00 
+      .00    11.18      .00 
+      .00     8.73      .00 
+     1.00   -11.21     1.00 
+     1.00   -13.24      .00 
+      .00    19.34      .00 
+      .00     9.32     1.00 
+      .00    17.97     1.00 
+     1.00    -1.56     1.00 
+     1.00    -3.13      .00 
+      .00     3.98      .00 
+      .00    -1.21     1.00 
+      .00     2.37      .00 
+     1.00   -18.03     1.00 
+])
+
+AT_DATA([miss.sps], [dnl
+data list notable  file='data.txt'  list /y x1 cat0*.
+
+logistic regression y with x1 cat0
+       /categorical = cat0.
+])
+
+AT_CHECK([pspp -O format=csv miss.sps > file1], [0], [ignore])
+
+dnl Append a case with a missing categorical.
+AT_CHECK([echo '1  34   .' >> data.txt], [0], [ignore])
+
+AT_CHECK([pspp -O format=csv miss.sps > file2], [0], [ignore])
+
+AT_CHECK([diff file1 file2], [1], [dnl
+8,10c8,10
+< Included in Analysis,100,100.00
+< Missing Cases,0,.00
+< Total,100,100.00
+---
+> Included in Analysis,100,99.01
+> Missing Cases,1,.99
+> Total,101,100.00
+])
+
+AT_CLEANUP
+