-
AT_BANNER([LOGISTIC REGRESSION])
dnl These examples are adapted from
Step 1,-2 Log likelihood,Cox & Snell R Square,Nagelkerke R Square
,37.323,.455,.659
+Table: Classification Table
+,,,Predicted,,
+,,,outcome,,"Percentage
+Correct"
+,Observed,,1.000,2.000,
+Step 1,outcome,1.000,43,5,89.583
+,,2.000,4,14,77.778
+,Overall Percentage,,,,86.364
+
Table: Variables in the Equation
,,B,S.E.,Wald,df,Sig.,Exp(B)
Step 1,survrate,-.081,.019,17.756,1,.000,.922
< Total,66,100.000
---
> Total,63,100.000
+23,24c23,24
+< Step 1,outcome,1.000,43,5,89.583
+< ,,2.000,4,14,77.778
+---
+> Step 1,outcome,1.000,43.000,5.000,89.583
+> ,,2.000,4.000,14.000,77.778
])
Step 1,-2 Log likelihood,Cox & Snell R Square,Nagelkerke R Square
,275.637,.008,.011
+Table: Classification Table
+,,,Predicted,,
+,,,female,,"Percentage
+Correct"
+,Observed,,.00,1.00,
+Step 1,female,.00,0,91,.000
+,,1.00,0,109,100.000
+,Overall Percentage,,,,54.500
+
Table: Variables in the Equation
,,B,S.E.,Wald,df,Sig.,Exp(B)
Step 1,constant,.180,.142,1.616,1,.204,1.198
,3.000,121,0,0,1
,4.000,67,0,0,0
+Table: Classification Table
+,,,Predicted,,
+,,,y,,"Percentage
+Correct"
+,Observed,,4.000,9.000,
+Step 1,y,4.000,254,19,93.040
+,,9.000,97,30,23.622
+,Overall Percentage,,,,71.000
+
Table: Variables in the Equation
,,B,S.E.,Wald,df,Sig.,Exp(B)
Step 1,b1,.002,.001,4.284,1,.038,1.002
,b,95,0,1
,c,58,0,0
+Table: Classification Table
+,,,Predicted,,
+,,,honcomp,,"Percentage
+Correct"
+,Observed,,.000,1.000,
+Step 1,honcomp,.000,132,15,89.796
+,,1.000,26,27,50.943
+,Overall Percentage,,,,79.500
+
Table: Variables in the Equation
,,B,S.E.,Wald,df,Sig.,Exp(B)
Step 1,read,.098,.025,15.199,1,.000,1.103
])
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
+
+
+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
+