Enable the show value labels feature
[pspp] / tests / language / stats / logistic.at
1 AT_BANNER([LOGISTIC REGRESSION])
2
3 dnl These examples are adapted from
4 dnl http://www.uvm.edu/~dhowell/gradstat/psych341/lectures/Logistic%20Regression/LogisticReg1.html
5
6
7
8 m4_define([LOGIT_TEST_DATA],
9   [AT_DATA([lr-data.txt], dnl
10  105.00    1.00    33.00    3.00     2.00   .35  17.00  20.00  .50110  -2.00440 1
11  106.00    1.00    50.00    2.00     3.00   .38   7.00  15.00  .20168  -1.25264 1
12  107.00    1.00    91.00    3.00     2.00   .28  15.00   7.00  .00897  -1.00905 1
13  108.00    1.00    90.00    3.00     2.00   .20   2.00   2.00  .00972  -1.00982 1
14  109.00    1.00    70.00    3.00     3.00   .38  23.00  27.00  .04745  -1.04981 1
15  111.00    2.00    31.00    2.00     2.00   .00  19.00  10.00  .54159   1.84640 1
16  112.00    1.00    91.00    2.00     3.00   .18   6.00  16.00  .00897  -1.00905 1
17  113.00    1.00    81.00    3.00     2.00   .00   3.00   9.00  .01998  -1.02039 1
18  114.00    2.00    15.00    1.00     2.00   .13  19.00  13.00  .81241   1.23090 1
19  116.00    2.00     1.00    1.00     2.00   .88  15.00   7.00  .93102   1.07410 1
20  117.00    1.00    93.00    3.00     2.00   .18   9.00  15.00  .00764  -1.00770 1
21  118.00    2.00    14.00    1.00     3.00   .15  23.00  18.00  .82447   1.21289 1
22  120.00    1.00    91.00    2.00     2.00   .43  17.00  14.00  .00897  -1.00905 1
23  121.00    1.00    55.00    3.00     2.00   .69  20.00  14.00  .14409  -1.16834 1
24  122.00    1.00    70.00    2.00     3.00   .03    .00   6.00  .04745  -1.04981 1
25  123.00    1.00    25.00    2.00     2.00   .45   4.00  10.00  .65789  -2.92301 1
26  125.00    1.00    91.00    2.00     2.00   .13    .00   3.00  .00897  -1.00905 1
27  126.00    1.00    91.00    3.00     3.00   .23   4.00   6.00  .00897  -1.00905 1
28  127.00    1.00    91.00    3.00     2.00   .00   8.00   8.00  .00897  -1.00905 1
29  128.00    2.00    13.00    2.00     2.00   .65  16.00  14.00  .83592   1.19629 1
30  129.00    1.00    50.00    2.00     2.00   .25  20.00  23.00  .20168  -1.25264 1
31  135.00    1.00    90.00    3.00     3.00   .03   5.00  12.00  .00972  -1.00982 1
32  138.00    1.00    70.00    3.00     3.00   .10   1.00   6.00  .04745  -1.04981 1
33  139.00    2.00    19.00    3.00     3.00   .10  11.00  12.00  .75787   1.31949 1
34  149.00    2.00    50.00    3.00     2.00   .03    .00    .00  .20168   4.95826 1
35  204.00    1.00    50.00    3.00     1.00   .13    .00   1.00  .20168  -1.25264 1
36  205.00    1.00    91.00    3.00     3.00   .72  16.00  18.00  .00897  -1.00905 1
37  206.00    2.00    24.00    1.00     1.00   .10   5.00  21.00  .67592   1.47947 1
38  207.00    1.00    80.00    3.00     3.00   .13   6.00   7.00  .02164  -1.02212 1
39  208.00    1.00    87.00    2.00     2.00   .18   9.00  20.00  .01237  -1.01253 1
40  209.00    1.00    70.00    2.00     2.00   .53  15.00  12.00  .04745  -1.04981 1
41  211.00    1.00    55.00    2.00     1.00   .33   8.00   5.00  .14409  -1.16834 1
42  212.00    1.00    56.00    3.00     1.00   .30   6.00  20.00  .13436  -1.15522 1
43  214.00    1.00    54.00    2.00     2.00   .15    .00  16.00  .15439  -1.18258 1
44  215.00    1.00    71.00    3.00     3.00   .35  12.00  12.00  .04391  -1.04592 1
45  217.00    2.00    36.00    1.00     1.00   .10  12.00   8.00  .44049   2.27020 1
46  218.00    1.00    91.00    2.00     2.00   .05  11.00  25.00  .00897  -1.00905 1
47  219.00    1.00    91.00    2.00     2.00  1.23  11.00  24.00  .00897  -1.00905 1
48  220.00    1.00    91.00    2.00     3.00   .08   8.00  11.00  .00897  -1.00905 1
49  221.00    1.00    91.00    2.00     2.00   .33   5.00  11.00  .00897  -1.00905 1
50  222.00    2.00    36.00    2.00     1.00   .18   5.00   3.00  .44049   2.27020 1
51  223.00    1.00    70.00    2.00     3.00   .18  14.00   3.00  .04745  -1.04981 1
52  224.00    1.00    91.00    2.00     2.00   .43   2.00  10.00  .00897  -1.00905 1
53  225.00    1.00    55.00    2.00     1.00   .18   6.00  11.00  .14409  -1.16834 1
54  229.00    2.00    75.00    2.00     2.00   .40  30.00  25.00  .03212  31.12941 1
55  232.00    1.00    91.00    3.00     2.00   .15   6.00   3.00  .00897  -1.00905 1
56  233.00    1.00    70.00    2.00     1.00   .00  11.00   8.00  .04745  -1.04981 1
57  234.00    1.00    54.00    3.00     2.00   .10    .00    .00  .15439  -1.18258 1
58  237.00    1.00    70.00    3.00     2.00   .18   5.00  25.00  .04745  -1.04981 1
59  241.00    1.00    19.00    2.00     3.00   .33  13.00   9.00  .75787  -4.12995 1
60  304.00    2.00    18.00    2.00     2.00   .26  25.00   6.00  .77245   1.29458 1
61  305.00    1.00    88.00    3.00     2.00  1.35  17.00  29.00  .01142  -1.01155 1
62  306.00    1.00    70.00    2.00     3.00   .63  14.00  33.00  .04745  -1.04981 1
63  307.00    1.00    85.00    2.00     2.00  2.65  18.00  14.00  .01452  -1.01474 1
64  308.00    1.00    13.00    2.00     2.00   .23   5.00   5.00  .83592  -6.09442 1
65  309.00    2.00    13.00    2.00     2.00   .23   7.00  17.00  .83592   1.19629 1
66  311.00    2.00     1.00    2.00     2.00   .50  20.00  14.00  .93102   1.07410 1
67  315.00    1.00    19.00    2.00     3.00   .18   1.00  11.00  .75787  -4.12995 1
68  316.00    1.00    88.00    2.00     2.00   .38  12.00  11.00  .01142  -1.01155 2
69  318.00    1.00    88.00    3.00     2.00   .03   5.00   5.00  .01142  -1.01155 3
70  319.00    2.00    18.00    2.00     3.00   .30  15.00  16.00  .77245   1.29458 1
71  321.00    2.00    15.00    2.00     2.00   .63  15.00  18.00  .81241   1.23090 1
72  322.00    1.00    88.00    3.00     2.00   .40  18.00  15.00  .01142  -1.01155 1
73  325.00    2.00    18.00    2.00     3.00  1.00  28.00  18.00  .77245   1.29458 1
74  329.00    1.00    88.00    3.00     2.00   .03   7.00  11.00  .01142  -1.01155 4
75  332.00    2.00     2.00    2.00     2.00   .05   8.00   9.00  .92562   1.08036 1
76 )])
77
78 dnl  Note: In the above data cases 305, 316 318 and 329 have identical values
79 dnl of the 2nd and 3rd variables.  We use this for weight testing.
80
81 AT_SETUP([LOGISTIC REGRESSION basic test])
82
83 LOGIT_TEST_DATA
84
85 AT_DATA([lr-data.sps], [dnl
86 set format = F12.3.
87 set decimal dot.
88 data list notable file='lr-data.txt'
89  list /id outcome survrate prognos amttreat   gsi  avoid intrus   pre_1     lre_1  w *.
90
91 logistic regression
92           variables = outcome with survrate
93         .
94 ])
95
96 AT_CHECK([pspp -O format=csv lr-data.sps], [0],
97   [dnl
98 Table: Dependent Variable Encoding
99 Original Value,Internal Value
100 1.000,0
101 2.000,1
102
103 Table: Case Processing Summary
104 Unweighted Cases,N,Percent
105 Included in Analysis,66,100.000
106 Missing Cases,0,.000
107 Total,66,100.000
108
109 note: Estimation terminated at iteration number 6 because parameter estimates changed by less than 0.001
110
111 Table: Model Summary
112 Step 1,-2 Log likelihood,Cox & Snell R Square,Nagelkerke R Square
113 ,37.323,.455,.659
114
115 Table: Classification Table
116 ,,,Predicted,,
117 ,,,outcome,,"Percentage
118 Correct"
119 ,Observed,,1.000,2.000,
120 Step 1,outcome,1.000,43,5,89.583
121 ,,2.000,4,14,77.778
122 ,Overall Percentage,,,,86.364
123
124 Table: Variables in the Equation
125 ,,B,S.E.,Wald,df,Sig.,Exp(B)
126 Step 1,survrate,-.081,.019,17.756,1,.000,.922
127 ,Constant,2.684,.811,10.941,1,.001,14.639
128 ])
129
130
131 AT_CLEANUP
132
133 AT_SETUP([LOGISTIC REGRESSION missing values])
134
135 LOGIT_TEST_DATA
136
137 AT_DATA([lr-data.sps], [dnl
138 set format = F12.3.
139 set decimal dot.
140 data list notable file='lr-data.txt'
141  list /id outcome survrate prognos amttreat   gsi  avoid intrus   pre_1     lre_1  w *.
142
143 missing values survrate (999) avoid (44444) outcome (99).
144
145 logistic regression
146           variables = outcome with survrate avoid
147         .
148 ])
149
150 AT_CHECK([pspp -O format=csv lr-data.sps > run0], [0], [ignore])
151
152 dnl Append some cases with missing values into the data.
153 cat >> lr-data.txt << HERE
154  105.00    1.00    999.00    3.00     2.00   .35  17.00  20.00  .50110  -2.00440 1
155  106.00    1.00    999.00    2.00     3.00   .38   7.00  15.00  .20168  -1.25264 1
156  107.00    1.00    5.00      3.00     2.00   .28  44444  34     .00897  -1.00905 1
157  108.00    99      5.00      3.00     2.00   .28  4      34     .00897  -1.00905 1
158 HERE
159
160 AT_CHECK([pspp -O format=csv lr-data.sps > run1], [0], [ignore])
161
162 dnl Only the summary information should be different
163 AT_CHECK([diff run0 run1], [1], [dnl
164 8,10c8,10
165 < Included in Analysis,66,100.000
166 < Missing Cases,0,.000
167 < Total,66,100.000
168 ---
169 > Included in Analysis,66,94.286
170 > Missing Cases,4,5.714
171 > Total,70,100.000
172 ])
173
174 AT_CLEANUP
175
176
177
178 dnl Check that a weighted dataset is interpreted correctly
179 dnl To do this, the same data set is used, one weighted, one not.
180 dnl The weighted dataset omits certain cases which are identical
181 AT_SETUP([LOGISTIC REGRESSION weights])
182
183 LOGIT_TEST_DATA
184
185 AT_DATA([lr-data-unweighted.sps], [dnl
186 set format = F12.3.
187 set decimal dot.
188 data list notable file='lr-data.txt'
189  list /id outcome survrate prognos amttreat   gsi  avoid intrus   pre_1     lre_1  w *.
190
191 logistic regression
192           variables = outcome with survrate
193         .
194 ])
195
196 AT_DATA([lr-data-weighted.sps], [dnl
197 set format = F12.3.
198 set decimal dot.
199 data list notable file='lr-data.txt'
200  list /id outcome survrate prognos amttreat   gsi  avoid intrus   pre_1     lre_1  w *.
201
202 weight by w.
203
204 * Omit duplicate cases.
205 select if id <> 305 and id <> 316 and id <> 318.
206
207 logistic regression
208           variables = outcome with survrate
209         .
210 ])
211
212
213 AT_CHECK([pspp -O format=csv lr-data-unweighted.sps > unweighted-result], [0], [ignore])
214 AT_CHECK([pspp -O format=csv lr-data-weighted.sps > weighted-result], [0], [ignore])
215
216 dnl The only difference should be the summary information, since
217 dnl this displays the unweighted totals.
218 AT_CHECK([diff unweighted-result weighted-result], [1], [dnl
219 8c8
220 < Included in Analysis,66,100.000
221 ---
222 > Included in Analysis,63,100.000
223 10c10
224 < Total,66,100.000
225 ---
226 > Total,63,100.000
227 23,24c23,24
228 < Step 1,outcome,1.000,43,5,89.583
229 < ,,2.000,4,14,77.778
230 ---
231 > Step 1,outcome,1.000,43.000,5.000,89.583
232 > ,,2.000,4.000,14.000,77.778
233 ])
234
235
236 AT_CLEANUP
237
238
239 dnl Check that the /NOCONST option works as intended.
240 dnl The results this produces are very similar to those
241 dnl at the example in http://www.ats.ucla.edu/stat/SPSS/faq/logregconst.htm
242 AT_SETUP([LOGISTIC REGRESSION without constant])
243
244 AT_DATA([non-const.sps], [dnl
245 set format=F20.3.
246
247 input program.
248  loop #i = 1 to 200.
249   compute female = (#i > 91).
250   end case.
251  end loop.
252 end file.
253 end input program.
254
255 compute constant = 1.
256
257 logistic regression female with constant /noconst.
258 ])
259
260 AT_CHECK([pspp -O format=csv non-const.sps], [0],
261  [dnl
262 Table: Dependent Variable Encoding
263 Original Value,Internal Value
264 .00,0
265 1.00,1
266
267 Table: Case Processing Summary
268 Unweighted Cases,N,Percent
269 Included in Analysis,200,100.000
270 Missing Cases,0,.000
271 Total,200,100.000
272
273 note: Estimation terminated at iteration number 2 because parameter estimates changed by less than 0.001
274
275 Table: Model Summary
276 Step 1,-2 Log likelihood,Cox & Snell R Square,Nagelkerke R Square
277 ,275.637,.008,.011
278
279 Table: Classification Table
280 ,,,Predicted,,
281 ,,,female,,"Percentage
282 Correct"
283 ,Observed,,.00,1.00,
284 Step 1,female,.00,0,91,.000
285 ,,1.00,0,109,100.000
286 ,Overall Percentage,,,,54.500
287
288 Table: Variables in the Equation
289 ,,B,S.E.,Wald,df,Sig.,Exp(B)
290 Step 1,constant,.180,.142,1.616,1,.204,1.198
291 ])
292
293 AT_CLEANUP
294
295
296
297 dnl Check that if somebody passes a dependent variable which is not dichtomous,
298 dnl then an error is raised.
299 AT_SETUP([LOGISTIC REGRESSION non-dichotomous dep var])
300
301 AT_DATA([non-dich.sps], [dnl
302 data list notable list /y x1 x2 x3 x4.
303 begin data.
304 1 2 3 4 5
305 0 2 3 4 8
306 2 3 4 5 6
307 end data.
308
309 logistic regression y with x1 x2 x3 x4.
310 ])
311
312 AT_CHECK([pspp -O format=csv non-dich.sps], [1],
313  [dnl
314 error: Dependent variable's values are not dichotomous.
315 ])
316
317 AT_CLEANUP
318
319
320
321 dnl An example to check the behaviour of LOGISTIC REGRESSION with a categorical
322 dnl variable.  This examṕle was inspired from that at:
323 dnl http://www.ats.ucla.edu/stat/spss/dae/logit.htm 
324 AT_SETUP([LOGISTIC REGRESSION with categorical])
325
326 AT_DATA([lr-cat.data], [dnl
327  620 3.07 2 4 
328  800 4.00 3 9 
329  580 3.40 2 4 
330  600 3.13 2 4 
331  540 2.70 2 4 
332  660 3.31 4 4 
333  480 3.58 1 9 
334  620 4.00 1 9 
335  680 3.98 2 9 
336  580 3.40 4 4 
337  760 3.35 3 4 
338  700 3.72 2 4 
339  460 3.64 1 9 
340  540 3.28 3 4 
341  680 3.48 3 4 
342  740 3.31 1 4 
343  460 3.77 3 4 
344  740 3.54 1 4 
345  600 3.63 3 4 
346  620 3.05 2 4 
347  560 3.04 3 4 
348  520 2.70 3 4 
349  640 3.35 3 4 
350  620 3.58 2 4 
351  660 3.70 4 9 
352  500 2.86 4 4 
353  640 3.50 2 4 
354  720 4.00 3 4 
355  720 3.94 3 4 
356  400 3.65 2 4 
357  800 2.90 2 4 
358  520 2.90 3 4 
359  440 3.24 4 4 
360  580 3.51 2 4 
361  500 3.31 3 4 
362  440 3.22 1 4 
363  540 3.17 1 9 
364  420 3.02 1 4 
365  780 3.22 2 9 
366  440 3.13 4 4 
367  800 3.66 1 9 
368  580 3.32 2 9 
369  480 2.67 2 9 
370  700 4.00 1 9 
371  740 2.97 2 9 
372  700 3.83 2 4 
373  640 3.93 2 4 
374  800 3.90 2 4 
375  400 3.38 2 4 
376  700 3.52 2 4 
377  680 3.00 4 9 
378  540 3.20 1 4 
379  580 4.00 2 4 
380  780 4.00 2 9 
381  220 2.83 3 4 
382  580 3.20 2 9 
383  580 3.50 2 4 
384  620 3.30 1 4 
385  520 3.65 4 9 
386  600 3.38 3 9 
387  660 3.77 3 4 
388  580 2.86 4 9 
389  580 3.46 2 9 
390  560 3.36 3 4 
391  740 4.00 3 9 
392  480 3.44 3 4 
393  640 3.19 4 9 
394  600 3.54 1 9 
395  540 3.38 4 4 
396  500 2.81 3 4 
397  360 2.56 3 4 
398  460 3.15 4 4 
399  460 2.63 2 4 
400  440 2.76 2 4 
401  740 3.62 4 4 
402  380 3.38 2 4 
403  640 3.63 1 9 
404  800 3.73 1 4 
405  660 3.67 2 4 
406  760 3.00 2 9 
407  420 2.96 1 4 
408  740 3.74 4 4 
409  800 3.75 2 4 
410  620 3.40 2 4 
411  660 3.67 3 9 
412  400 3.35 3 4 
413  680 3.14 2 4 
414  660 3.47 3 9 
415  660 3.63 2 9 
416  420 3.41 4 4 
417  660 4.00 1 4 
418  680 3.70 2 4 
419  620 3.23 3 9 
420  520 3.35 3 4 
421  500 4.00 3 4 
422  400 3.36 2 4 
423  700 3.56 1 9 
424  540 3.81 1 9 
425  520 2.68 3 9 
426  540 3.50 2 4 
427  700 4.00 2 4 
428  600 3.64 3 9 
429  800 3.31 3 4 
430  520 3.29 1 4 
431  580 3.69 1 4 
432  380 3.43 3 4 
433  560 3.19 3 4 
434  760 2.81 1 9 
435  540 3.13 2 4 
436  660 3.14 2 9 
437  520 3.81 1 9 
438  680 3.19 4 4 
439  540 3.78 4 4 
440  500 3.57 3 4 
441  660 3.49 2 4 
442  340 3.00 2 9 
443  400 3.15 2 9 
444  420 3.92 4 4 
445  760 3.35 2 9 
446  700 2.94 2 4 
447  540 3.04 1 4 
448  780 3.87 4 4 
449  560 3.78 2 4 
450  700 3.82 3 4 
451  400 2.93 3 4 
452  440 3.45 2 9 
453  800 3.47 3 4 
454  340 3.15 3 4 
455  520 4.00 1 9 
456  520 3.15 3 4 
457  600 2.98 2 9 
458  420 2.69 2 4 
459  460 3.44 2 4 
460  620 3.71 1 9 
461  480 3.13 2 4 
462  580 3.40 3 4 
463  540 3.39 3 9 
464  540 3.94 3 4 
465  440 2.98 3 4 
466  380 3.59 4 4 
467  500 2.97 4 4 
468  340 2.92 3 4 
469  440 3.15 2 4 
470  600 3.48 2 4 
471  420 2.67 3 4 
472  460 3.07 2 4 
473  460 3.45 3 9 
474  480 3.39 4 4 
475  480 2.78 3 4 
476  720 3.42 2 9 
477  680 3.67 2 9 
478  800 3.89 2 4 
479  360 3.00 3 4 
480  620 3.17 2 9 
481  700 3.52 4 9 
482  540 3.19 2 4 
483  580 3.30 2 4 
484  800 4.00 3 9 
485  660 3.33 2 4 
486  380 3.34 3 4 
487  720 3.84 3 4 
488  600 3.59 2 4 
489  500 3.03 3 4 
490  640 3.81 2 4 
491  540 3.49 1 9 
492  680 3.85 3 9 
493  540 3.84 2 9 
494  460 2.93 3 4 
495  380 2.94 3 4 
496  620 3.22 2 4 
497  740 3.37 4 4 
498  620 4.00 2 4 
499  800 3.74 1 9 
500  400 3.31 3 4 
501  540 3.46 4 4 
502  620 3.18 2 9 
503  480 2.91 1 9 
504  300 2.84 2 9 
505  440 2.48 4 4 
506  640 2.79 2 4 
507  400 3.23 4 9 
508  680 3.46 2 9 
509  620 3.37 1 9 
510  700 3.92 2 4 
511  620 3.37 2 9 
512  620 3.63 2 4 
513  620 3.95 3 9 
514  560 2.52 2 4 
515  520 2.62 2 4 
516  600 3.35 2 4 
517  700 4.00 1 4 
518  640 3.67 3 4 
519  640 4.00 3 4 
520  520 2.93 4 4 
521  620 3.21 4 4 
522  680 3.99 3 4 
523  660 3.34 3 4 
524  700 3.45 3 4 
525  560 3.36 1 9 
526  800 2.78 2 4 
527  500 3.88 4 4 
528  700 3.65 2 4 
529  680 3.76 3 9 
530  660 3.07 3 4 
531  580 3.46 4 4 
532  460 2.87 2 4 
533  600 3.31 4 4 
534  620 3.94 4 4 
535  400 3.05 2 4 
536  800 3.43 2 9 
537  600 3.58 1 9 
538  580 3.36 2 4 
539  540 3.16 3 4 
540  500 2.71 2 4 
541  600 3.28 3 4 
542  600 2.82 4 4 
543  460 3.58 2 4 
544  520 2.85 3 4 
545  740 3.52 4 9 
546  500 3.95 4 4 
547  560 3.61 3 4 
548  620 3.45 2 9 
549  640 3.51 2 4 
550  660 3.44 2 9 
551  660 2.91 3 9 
552  540 3.28 1 4 
553  560 2.98 1 9 
554  800 3.97 1 4 
555  720 3.77 3 4 
556  720 3.64 1 9 
557  480 3.71 4 9 
558  680 3.34 2 4 
559  680 3.11 2 4 
560  540 2.81 3 4 
561  620 3.75 2 9 
562  540 3.12 1 4 
563  560 3.48 2 9 
564  720 3.40 3 4 
565  680 3.90 1 4 
566  640 3.76 3 4 
567  560 3.16 1 4 
568  520 3.30 2 9 
569  640 3.12 3 4 
570  580 3.57 3 4 
571  540 3.55 4 9 
572  780 3.63 4 9 
573  600 3.89 1 9 
574  800 4.00 1 9 
575  580 3.29 4 4 
576  360 3.27 3 4 
577  800 4.00 2 9 
578  640 3.52 4 4 
579  720 3.45 4 4 
580  580 3.06 2 4 
581  580 3.02 2 4 
582  500 3.60 3 9 
583  580 3.12 3 9 
584  600 2.82 4 4 
585  620 3.99 3 4 
586  700 4.00 3 4 
587  480 4.00 2 4 
588  560 2.95 2 4 
589  560 4.00 3 4 
590  560 2.65 3 9 
591  400 3.08 2 4 
592  480 2.62 2 9 
593  640 3.86 3 4 
594  480 3.57 2 4 
595  540 3.51 2 4 
596  380 3.33 4 4 
597  680 3.64 3 4 
598  400 3.51 3 4 
599  340 2.90 1 4 
600  700 3.08 2 4 
601  480 3.02 1 9 
602  600 3.15 2 9 
603  780 3.80 3 9 
604  520 3.74 2 9 
605  520 3.51 2 4 
606  640 3.73 3 4 
607  560 3.32 4 4 
608  620 2.85 2 4 
609  700 3.28 1 4 
610  760 4.00 1 9 
611  800 3.60 2 4 
612  580 3.34 2 4 
613  540 3.77 2 9 
614  640 3.17 2 4 
615  540 3.02 4 4 
616  680 3.08 4 4 
617  680 3.31 2 4 
618  680 2.96 3 9 
619  700 2.88 2 4 
620  580 3.77 4 4 
621  540 3.49 2 9 
622  700 3.56 2 9 
623  600 3.56 2 9 
624  560 3.59 2 4 
625  640 2.94 2 9 
626  560 3.33 4 4 
627  620 3.69 3 4 
628  680 3.27 2 9 
629  460 3.14 3 4 
630  500 3.53 4 4 
631  620 3.33 3 4 
632  600 3.62 3 4 
633  500 3.01 4 4 
634  740 3.34 4 4 
635  560 3.69 3 9 
636  620 3.95 3 9 
637  740 3.86 2 9 
638  800 3.53 1 9 
639  620 3.78 3 4 
640  700 3.27 2 4 
641  540 3.78 2 9 
642  700 3.65 2 4 
643  800 3.22 1 9 
644  560 3.59 2 9 
645  800 3.15 4 4 
646  520 3.90 3 9 
647  520 3.74 4 9 
648  480 2.55 1 4 
649  800 4.00 4 4 
650  620 3.09 4 4 
651  560 3.49 4 4 
652  500 3.17 3 4 
653  480 3.40 2 4 
654  460 2.98 1 4 
655  580 3.58 1 9 
656  640 3.30 2 4 
657  480 3.45 2 4 
658  440 3.17 2 4 
659  660 3.32 1 4 
660  500 3.08 3 4 
661  660 3.94 2 4 
662  720 3.31 1 4 
663  460 3.64 3 9 
664  500 2.93 4 4 
665  800 3.54 3 4 
666  580 2.93 2 4 
667  620 3.61 1 9 
668  500 2.98 3 4 
669  660 4.00 2 9 
670  560 3.24 4 4 
671  560 2.42 2 4 
672  580 3.80 2 4 
673  500 3.23 4 4 
674  680 2.42 1 9 
675  580 3.46 3 4 
676  800 3.91 3 4 
677  700 2.90 4 4 
678  520 3.12 2 4 
679  300 2.92 4 4 
680  560 3.43 3 4 
681  620 3.63 3 4 
682  500 2.79 4 4 
683  360 3.14 1 4 
684  640 3.94 2 9 
685  460 3.99 3 9 
686  300 3.01 3 4 
687  520 2.73 2 4 
688  600 3.47 2 9 
689  580 3.25 1 4 
690  520 3.10 4 4 
691  620 3.43 3 4 
692  380 2.91 4 4 
693  660 3.59 3 4 
694  660 3.95 2 9 
695  540 3.33 3 4 
696  740 4.00 3 4 
697  640 3.38 3 4 
698  600 3.89 3 4 
699  720 3.88 3 4 
700  580 4.00 3 4 
701  420 2.26 4 4 
702  520 4.00 2 9 
703  800 3.70 1 9 
704  700 4.00 1 9 
705  480 3.43 2 4 
706  660 3.45 4 4 
707  520 3.25 3 4 
708  560 2.71 3 4 
709  600 3.32 2 4 
710  580 2.88 2 4 
711  660 3.88 2 9 
712  600 3.22 1 4 
713  580 4.00 1 4 
714  660 3.60 3 9 
715  500 3.35 2 4 
716  520 2.98 2 4 
717  660 3.49 2 9 
718  560 3.07 2 4 
719  500 3.13 2 9 
720  720 3.50 3 9 
721  440 3.39 2 9 
722  640 3.95 2 9 
723  380 3.61 3 4 
724  800 3.05 2 9 
725  520 3.19 3 9 
726  600 3.40 3 4 
727 ])
728
729 AT_DATA([lr-cat.sps], [dnl
730 set format=F20.3.
731
732 data list notable list file='lr-cat.data' /b1 b2 bcat y.
733
734 logistic regression
735           y with b1 b2 bcat
736            /categorical = bcat
737            .
738 ])
739
740 AT_CHECK([pspp -O format=csv lr-cat.sps], [0],
741  [dnl
742 Table: Dependent Variable Encoding
743 Original Value,Internal Value
744 4.000,0
745 9.000,1
746
747 Table: Case Processing Summary
748 Unweighted Cases,N,Percent
749 Included in Analysis,400,100.000
750 Missing Cases,0,.000
751 Total,400,100.000
752
753 note: Estimation terminated at iteration number 4 because parameter estimates changed by less than 0.001
754
755 Table: Model Summary
756 Step 1,-2 Log likelihood,Cox & Snell R Square,Nagelkerke R Square
757 ,458.517,.098,.138
758
759 Table: Categorical Variables' Codings
760 ,,,Parameter coding,,
761 ,,Frequency,(1),(2),(3)
762 bcat,1.000,61,1,0,0
763 ,2.000,151,0,1,0
764 ,3.000,121,0,0,1
765 ,4.000,67,0,0,0
766
767 Table: Classification Table
768 ,,,Predicted,,
769 ,,,y,,"Percentage
770 Correct"
771 ,Observed,,4.000,9.000,
772 Step 1,y,4.000,254,19,93.040
773 ,,9.000,97,30,23.622
774 ,Overall Percentage,,,,71.000
775
776 Table: Variables in the Equation
777 ,,B,S.E.,Wald,df,Sig.,Exp(B)
778 Step 1,b1,.002,.001,4.284,1,.038,1.002
779 ,b2,.804,.332,5.872,1,.015,2.235
780 ,bcat,,,20.895,3,.000,
781 ,bcat(1),1.551,.418,13.788,1,.000,4.718
782 ,bcat(2),.876,.367,5.706,1,.017,2.401
783 ,bcat(3),.211,.393,.289,1,.591,1.235
784 ,Constant,-5.541,1.138,23.709,1,.000,.004
785 ])
786
787 AT_CLEANUP
788
789
790
791 dnl  This example is inspired by http://www.ats.ucla.edu/stat/spss/output/logistic.htm
792 AT_SETUP([LOGISTIC REGRESSION with cat var 2])
793
794 AT_DATA([lr-cat2.data], [dnl
795      60.00     1.00      8.00     50.00 
796      47.00      .00      9.00     42.00 
797      57.00     1.00      7.00     53.00 
798      60.00      .00      8.00     53.00 
799      68.00      .00      8.00     66.00 
800      63.00      .00      8.00     55.00 
801      65.00      .00      8.00     63.00 
802      52.00      .00      8.00     61.00 
803      34.00      .00      9.00     42.00 
804      37.00      .00      8.00     39.00 
805      68.00     1.00      9.00     69.00 
806      60.00      .00      9.00     61.00 
807      44.00      .00      9.00     58.00 
808      42.00      .00      8.00     47.00 
809      57.00     1.00      7.00     61.00 
810      55.00     1.00      8.00     50.00 
811      55.00      .00      9.00     58.00 
812      44.00      .00      8.00     63.00 
813      50.00     1.00      9.00     66.00 
814      44.00      .00      8.00     39.00 
815      55.00      .00      8.00     58.00 
816      44.00      .00      8.00     50.00 
817      47.00     1.00      7.00     34.00 
818      48.00      .00      8.00     44.00 
819      45.00      .00      7.00     31.00 
820      43.00      .00      8.00     50.00 
821      39.00      .00      8.00     42.00 
822      63.00      .00      9.00     50.00 
823      47.00      .00      8.00     58.00 
824      42.00      .00      7.00     50.00 
825      50.00      .00      9.00     36.00 
826      47.00      .00      7.00     33.00 
827      60.00      .00      9.00     61.00 
828      47.00      .00      7.00     42.00 
829      68.00     1.00      9.00     69.00 
830      52.00      .00      8.00     54.00 
831      63.00     1.00      9.00     61.00 
832      65.00     1.00      9.00     61.00 
833      63.00     1.00      9.00     53.00 
834      57.00      .00      8.00     51.00 
835      34.00      .00      8.00     36.00 
836      50.00      .00      8.00     39.00 
837      52.00     1.00      7.00     56.00 
838      45.00      .00      7.00     34.00 
839      47.00     1.00      7.00     53.00 
840      34.00      .00      7.00     39.00 
841      50.00     1.00      8.00     55.00 
842      60.00      .00      9.00     58.00 
843      63.00      .00      8.00     58.00 
844      35.00      .00      7.00     51.00 
845      50.00      .00      8.00     58.00 
846      68.00      .00      8.00     63.00 
847      41.00      .00      9.00     34.00 
848      47.00      .00      8.00     47.00 
849      76.00      .00      9.00     64.00 
850      44.00      .00      8.00     44.00 
851      36.00      .00      9.00     50.00 
852      68.00     1.00      9.00     55.00 
853      47.00     1.00      8.00     50.00 
854      50.00      .00      7.00     53.00 
855      68.00      .00      8.00     74.00 
856      39.00      .00      7.00     44.00 
857      50.00      .00      8.00     55.00 
858      52.00      .00      9.00     61.00 
859      47.00      .00      8.00     53.00 
860      39.00      .00      7.00     47.00 
861      55.00     1.00      9.00     49.00 
862      68.00     1.00      8.00     50.00 
863      52.00     1.00      9.00     63.00 
864      55.00      .00      8.00     58.00 
865      57.00      .00      8.00     55.00 
866      66.00     1.00      9.00     61.00 
867      65.00     1.00      7.00     58.00 
868      42.00      .00      7.00     42.00 
869      68.00     1.00      7.00     59.00 
870      60.00     1.00      9.00     61.00 
871      52.00      .00      8.00     55.00 
872      57.00     1.00      7.00     54.00 
873      42.00      .00      9.00     50.00 
874      42.00      .00      8.00     47.00 
875      57.00      .00      8.00     50.00 
876      47.00      .00      7.00     45.00 
877      44.00      .00      7.00     40.00 
878      43.00      .00      9.00     55.00 
879      31.00      .00      8.00     39.00 
880      37.00      .00      7.00     33.00 
881      63.00     1.00      7.00     63.00 
882      47.00      .00      8.00     39.00 
883      57.00     1.00      8.00     63.00 
884      52.00      .00      8.00     44.00 
885      44.00      .00      7.00     35.00 
886      52.00      .00      7.00     55.00 
887      55.00      .00      7.00     69.00 
888      52.00      .00      8.00     53.00 
889      55.00      .00      9.00     61.00 
890      65.00     1.00      9.00     63.00 
891      55.00      .00      8.00     44.00 
892      63.00      .00      7.00     65.00 
893      44.00      .00      7.00     39.00 
894      47.00      .00      7.00     36.00 
895      63.00     1.00      9.00     55.00 
896      68.00      .00      8.00     66.00 
897      34.00      .00      8.00     39.00 
898      47.00      .00      9.00     50.00 
899      50.00      .00      9.00     58.00 
900      63.00      .00      8.00     66.00 
901      44.00      .00      7.00     34.00 
902      44.00      .00      8.00     50.00 
903      50.00      .00      8.00     53.00 
904      47.00     1.00      9.00     69.00 
905      65.00      .00      9.00     58.00 
906      57.00      .00      8.00     47.00 
907      39.00      .00      8.00     39.00 
908      47.00      .00      8.00     53.00 
909      50.00     1.00      7.00     63.00 
910      50.00      .00      8.00     50.00 
911      63.00      .00      9.00     53.00 
912      73.00     1.00      9.00     61.00 
913      44.00      .00      7.00     47.00 
914      47.00      .00      8.00     42.00 
915      47.00      .00      8.00     58.00 
916      36.00      .00      7.00     61.00 
917      57.00     1.00      8.00     55.00 
918      53.00     1.00      8.00     57.00 
919      63.00      .00      7.00     66.00 
920      50.00      .00      8.00     34.00 
921      47.00      .00      9.00     48.00 
922      57.00     1.00      8.00     58.00 
923      39.00      .00      8.00     53.00 
924      42.00      .00      8.00     42.00 
925      42.00      .00      9.00     31.00 
926      42.00      .00      8.00     72.00 
927      46.00      .00      8.00     44.00 
928      55.00      .00      8.00     42.00 
929      42.00      .00      8.00     47.00 
930      50.00      .00      8.00     44.00 
931      44.00      .00      9.00     39.00 
932      73.00     1.00      8.00     69.00 
933      71.00     1.00      9.00     58.00 
934      50.00      .00      9.00     49.00 
935      63.00     1.00      7.00     54.00 
936      42.00      .00      8.00     36.00 
937      47.00      .00      7.00     42.00 
938      39.00      .00      9.00     26.00 
939      63.00      .00      8.00     58.00 
940      50.00      .00      8.00     55.00 
941      65.00     1.00      8.00     55.00 
942      76.00     1.00      9.00     67.00 
943      71.00     1.00      8.00     66.00 
944      39.00      .00      9.00     47.00 
945      47.00     1.00      9.00     63.00 
946      60.00      .00      7.00     50.00 
947      63.00      .00      9.00     55.00 
948      54.00     1.00      9.00     55.00 
949      55.00     1.00      8.00     58.00 
950      57.00      .00      8.00     61.00 
951      55.00     1.00      9.00     63.00 
952      42.00      .00      7.00     50.00 
953      50.00      .00      8.00     44.00 
954      55.00      .00      8.00     42.00 
955      42.00      .00      7.00     50.00 
956      34.00      .00      8.00     39.00 
957      65.00      .00      9.00     46.00 
958      52.00      .00      7.00     58.00 
959      44.00      .00      8.00     39.00 
960      65.00     1.00      9.00     66.00 
961      47.00      .00      8.00     42.00 
962      41.00      .00      7.00     39.00 
963      68.00      .00      9.00     63.00 
964      63.00     1.00      8.00     72.00 
965      52.00      .00      8.00     53.00 
966      57.00      .00      8.00     50.00 
967      68.00      .00      8.00     55.00 
968      42.00      .00      8.00     56.00 
969      47.00      .00      8.00     48.00 
970      73.00     1.00      9.00     58.00 
971      39.00      .00      8.00     50.00 
972      63.00     1.00      9.00     69.00 
973      60.00      .00      8.00     55.00 
974      65.00     1.00      9.00     66.00 
975      73.00     1.00      8.00     63.00 
976      52.00      .00      8.00     55.00 
977      36.00      .00      8.00     42.00 
978      28.00      .00      7.00     44.00 
979      47.00      .00      8.00     44.00 
980      57.00      .00      7.00     47.00 
981      34.00      .00      7.00     29.00 
982      47.00      .00      9.00     66.00 
983      57.00      .00      8.00     58.00 
984      60.00     1.00      9.00     50.00 
985      50.00      .00      9.00     47.00 
986      73.00     1.00      9.00     55.00 
987      52.00     1.00      8.00     47.00 
988      55.00      .00      8.00     53.00 
989      47.00      .00      8.00     53.00 
990      50.00      .00      8.00     61.00 
991      61.00      .00      7.00     44.00 
992      52.00      .00      9.00     53.00 
993      47.00      .00      7.00     40.00 
994      47.00      .00      7.00     50.00 
995 ])
996
997 AT_DATA([stringcat.sps], [dnl
998 set format=F20.3.
999 data list notable file='lr-cat2.data' list /read honcomp wiz science *.
1000
1001 string ses(a1).
1002 recode wiz (7 = "a") (8 = "b") (9 = "c") into ses.
1003
1004 logistic regression honcomp with read science ses
1005          /categorical = ses.
1006
1007 ])
1008
1009 AT_CHECK([pspp -O format=csv stringcat.sps], [0],
1010  [dnl
1011 Table: Dependent Variable Encoding
1012 Original Value,Internal Value
1013 .000,0
1014 1.000,1
1015
1016 Table: Case Processing Summary
1017 Unweighted Cases,N,Percent
1018 Included in Analysis,200,100.000
1019 Missing Cases,0,.000
1020 Total,200,100.000
1021
1022 note: Estimation terminated at iteration number 5 because parameter estimates changed by less than 0.001
1023
1024 Table: Model Summary
1025 Step 1,-2 Log likelihood,Cox & Snell R Square,Nagelkerke R Square
1026 ,165.701,.280,.408
1027
1028 Table: Categorical Variables' Codings
1029 ,,,Parameter coding,
1030 ,,Frequency,(1),(2)
1031 ses,a,47,1,0
1032 ,b,95,0,1
1033 ,c,58,0,0
1034
1035 Table: Classification Table
1036 ,,,Predicted,,
1037 ,,,honcomp,,"Percentage
1038 Correct"
1039 ,Observed,,.000,1.000,
1040 Step 1,honcomp,.000,132,15,89.796
1041 ,,1.000,26,27,50.943
1042 ,Overall Percentage,,,,79.500
1043
1044 Table: Variables in the Equation
1045 ,,B,S.E.,Wald,df,Sig.,Exp(B)
1046 Step 1,read,.098,.025,15.199,1,.000,1.103
1047 ,science,.066,.027,5.867,1,.015,1.068
1048 ,ses,,,6.690,2,.035,
1049 ,ses(1),.058,.532,.012,1,.913,1.060
1050 ,ses(2),-1.013,.444,5.212,1,.022,.363
1051 ,Constant,-9.561,1.662,33.113,1,.000,.000
1052 ])
1053
1054 AT_CLEANUP
1055
1056
1057 dnl Check that it doesn't crash if a categorical variable
1058 dnl has only one distinct value
1059 AT_SETUP([LOGISTIC REGRESSION identical categories])
1060
1061 AT_DATA([crash.sps], [dnl
1062 data list notable list /y x1 x2*.
1063 begin data
1064 0 1 1
1065 1 2 1
1066 end data.
1067
1068 logistic regression y with x1 x2
1069         /categorical = x2.
1070 ])
1071
1072 AT_CHECK([pspp -O format=csv crash.sps], [1], [ignore])
1073
1074 AT_CLEANUP
1075
1076
1077 dnl Test that missing values on the categorical predictors are treated
1078 dnl properly.
1079 AT_SETUP([LOGISTIC REGRESSION missing categoricals])
1080
1081 AT_DATA([data.txt], [dnl
1082       .00     3.69      .00 
1083       .00     1.16     1.00 
1084      1.00   -12.99      .00 
1085       .00     2.97     1.00 
1086       .00    20.48      .00 
1087       .00     4.90      .00 
1088      1.00    -4.38      .00 
1089       .00    -1.69     1.00 
1090      1.00    -5.71      .00 
1091      1.00   -14.28      .00 
1092       .00     9.00      .00 
1093       .00     2.89     1.00 
1094       .00    13.51     1.00 
1095       .00    23.32     1.00 
1096       .00     2.31     1.00 
1097       .00    -2.07     1.00 
1098      1.00    -4.52     1.00 
1099      1.00    -5.83      .00 
1100      1.00    -1.91      .00 
1101      1.00   -11.12     1.00 
1102       .00    -1.51      .00 
1103       .00     6.59     1.00 
1104       .00    19.28     1.00 
1105       .00     5.94      .00 
1106       .00     8.21     1.00 
1107       .00     8.11     1.00 
1108       .00     2.49      .00 
1109       .00     9.62      .00 
1110      1.00   -20.74     1.00 
1111       .00    -1.41     1.00 
1112       .00    15.15     1.00 
1113       .00     9.39      .00 
1114      1.00   -15.14     1.00 
1115      1.00    -5.86      .00 
1116      1.00   -11.64     1.00 
1117      1.00   -14.36      .00 
1118      1.00    -8.95     1.00 
1119      1.00   -16.42     1.00 
1120      1.00    -1.04     1.00 
1121       .00    12.89     1.00 
1122       .00    -7.08     1.00 
1123       .00     4.87     1.00 
1124       .00    11.53     1.00 
1125      1.00    -6.24     1.00 
1126       .00     1.25     1.00 
1127       .00     4.39     1.00 
1128       .00     3.17      .00 
1129       .00    19.39     1.00 
1130       .00    13.03     1.00 
1131       .00     2.43      .00 
1132      1.00   -14.73     1.00 
1133       .00     8.25     1.00 
1134      1.00   -13.28     1.00 
1135       .00     5.27     1.00 
1136      1.00    -3.46     1.00 
1137       .00    13.81     1.00 
1138       .00     1.35     1.00 
1139      1.00    -3.94     1.00 
1140       .00    20.73     1.00 
1141      1.00   -15.40      .00 
1142      1.00   -11.01     1.00 
1143       .00     4.56      .00 
1144      1.00   -15.35     1.00 
1145       .00    15.21      .00 
1146       .00     5.34     1.00 
1147      1.00   -21.55     1.00 
1148       .00    10.12     1.00 
1149       .00     -.73     1.00 
1150       .00    15.28     1.00 
1151       .00    11.08     1.00 
1152      1.00    -8.24      .00 
1153       .00     2.46      .00 
1154       .00     9.60      .00 
1155       .00    11.24      .00 
1156       .00    14.13     1.00 
1157       .00    19.72     1.00 
1158       .00     5.58      .00 
1159       .00    26.23     1.00 
1160       .00     7.25      .00 
1161      1.00     -.79      .00 
1162       .00     6.24      .00 
1163      1.00     1.16      .00 
1164      1.00    -7.89     1.00 
1165      1.00    -1.86     1.00 
1166      1.00   -10.80     1.00 
1167      1.00    -5.51      .00 
1168       .00     7.51      .00 
1169       .00    11.18      .00 
1170       .00     8.73      .00 
1171      1.00   -11.21     1.00 
1172      1.00   -13.24      .00 
1173       .00    19.34      .00 
1174       .00     9.32     1.00 
1175       .00    17.97     1.00 
1176      1.00    -1.56     1.00 
1177      1.00    -3.13      .00 
1178       .00     3.98      .00 
1179       .00    -1.21     1.00 
1180       .00     2.37      .00 
1181      1.00   -18.03     1.00 
1182 ])
1183
1184 AT_DATA([miss.sps], [dnl
1185 data list notable  file='data.txt'  list /y x1 cat0*.
1186
1187 logistic regression y with x1 cat0
1188         /categorical = cat0.
1189 ])
1190
1191 AT_CHECK([pspp -O format=csv miss.sps > file1], [0], [ignore])
1192
1193 dnl Append a case with a missing categorical.
1194 AT_CHECK([echo '1  34   .' >> data.txt], [0], [ignore])
1195
1196 AT_CHECK([pspp -O format=csv miss.sps > file2], [0], [ignore])
1197
1198 AT_CHECK([diff file1 file2], [1], [dnl
1199 8,10c8,10
1200 < Included in Analysis,100,100.00
1201 < Missing Cases,0,.00
1202 < Total,100,100.00
1203 ---
1204 > Included in Analysis,100,99.01
1205 > Missing Cases,1,.99
1206 > Total,101,100.00
1207 ])
1208
1209 AT_CLEANUP
1210
1211
1212 dnl Check that the confidence intervals are properly reported.
1213 dnl Use an example with categoricals, because that was buggy at
1214 dnl one point.  The data in this example comes from:
1215 dnl  http://people.ysu.edu/~gchang/SPSSE/SPSS_lab2Regression.pdf
1216 AT_SETUP([LOGISTIC REGRESSION confidence interval])
1217
1218 AT_DATA([ci.sps], [dnl
1219 set FORMAT=F20.3
1220 data list notable list /disease age sciostat sector savings *.
1221 begin data.
1222 0       33        1        1        1 
1223 0       35        1        1        1 
1224 0        6        1        1        0 
1225 0       60        1        1        1 
1226 1       18        3        1        0 
1227 0       26        3        1        0 
1228 0        6        3        1        0 
1229 1       31        2        1        1 
1230 1       26        2        1        0 
1231 0       37        2        1        0 
1232 0       23        1        1        0 
1233 0       23        1        1        0 
1234 0       27        1        1        1 
1235 1        9        1        1        1 
1236 1       37        1        2        1 
1237 1       22        1        2        1 
1238 1       67        1        2        1 
1239 0        8        1        2        1 
1240 1        6        1        2        1 
1241 1       15        1        2        1 
1242 1       21        2        2        1 
1243 1       32        2        2        1 
1244 1       16        1        2        1 
1245 0       11        2        2        0 
1246 0       14        3        2        0 
1247 0        9        2        2        0 
1248 0       18        2        2        0 
1249 0        2        3        1        0 
1250 0       61        3        1        1 
1251 0       20        3        1        0 
1252 0       16        3        1        0 
1253 0        9        2        1        0 
1254 0       35        2        1        1 
1255 0        4        1        1        1 
1256 0       44        3        2        0 
1257 1       11        3        2        0 
1258 0        3        2        2        1 
1259 0        6        3        2        0 
1260 1       17        2        2        0 
1261 0        1        3        2        1 
1262 1       53        2        2        1 
1263 1       13        1        2        0 
1264 0       24        1        2        0 
1265 1       70        1        2        1 
1266 1       16        3        2        1 
1267 0       12        2        2        1 
1268 1       20        3        2        1 
1269 0       65        3        2        1 
1270 1       40        2        2        0 
1271 1       38        2        2        1 
1272 1       68        2        2        1 
1273 1       74        1        2        1 
1274 1       14        1        2        1 
1275 1       27        1        2        1 
1276 0       31        1        2        1 
1277 0       18        1        2        1 
1278 0       39        1        2        0 
1279 0       50        1        2        1 
1280 0       31        1        2        1 
1281 0       61        1        2        1 
1282 0       18        3        1        0 
1283 0        5        3        1        0 
1284 0        2        3        1        1 
1285 0       16        3        1        0 
1286 1       59        3        1        1 
1287 0       22        3        1        0 
1288 0       24        1        1        1 
1289 0       30        1        1        1 
1290 0       46        1        1        1 
1291 0       28        1        1        0 
1292 0       27        1        1        1 
1293 1       27        1        1        0 
1294 0       28        1        1        1 
1295 1       52        1        1        1 
1296 0       11        3        1        1 
1297 0        6        2        1        1 
1298 0       46        3        1        0 
1299 1       20        2        1        1 
1300 0        3        1        1        1 
1301 0       18        2        1        0 
1302 0       25        2        1        0 
1303 0        6        3        1        1 
1304 1       65        3        1        1 
1305 0       51        3        1        1 
1306 0       39        2        1        1 
1307 0        8        1        1        1 
1308 0        8        2        1        0 
1309 0       14        3        1        0 
1310 0        6        3        1        0 
1311 0        6        3        1        1 
1312 0        7        3        1        0 
1313 0        4        3        1        0 
1314 0        8        3        1        0 
1315 0        9        2        1        0 
1316 1       32        3        1        0 
1317 0       19        3        1        0 
1318 0       11        3        1        0 
1319 0       35        3        1        0 
1320 0       16        1        1        0 
1321 0        1        1        1        1 
1322 0        6        1        1        1 
1323 0       27        1        1        1 
1324 0       25        1        1        1 
1325 0       18        1        1        0 
1326 0       37        3        1        0 
1327 1       33        3        1        0 
1328 0       27        2        1        0 
1329 0        2        1        1        0 
1330 0        8        2        1        0 
1331 0        5        1        1        0 
1332 0        1        1        1        1 
1333 0       32        1        1        0 
1334 1       25        1        1        1 
1335 0       15        1        2        0 
1336 0       15        1        2        1 
1337 0       26        1        2        1 
1338 1       42        1        2        1 
1339 0        7        1        2        1 
1340 0        2        1        2        0 
1341 1       65        1        2        1 
1342 0       33        2        2        1 
1343 1        8        2        2        0 
1344 0       30        2        2        0 
1345 0        5        3        2        0 
1346 0       15        3        2        0 
1347 1       60        3        2        1 
1348 1       13        3        2        1 
1349 0       70        3        1        1 
1350 0        5        3        1        0 
1351 0        3        3        1        1 
1352 0       50        2        1        1 
1353 0        6        2        1        0 
1354 0       12        2        1        1 
1355 1       39        3        2        0 
1356 0       15        2        2        1 
1357 1       35        2        2        0 
1358 0        2        2        2        1 
1359 0       17        3        2        0 
1360 1       43        3        2        1 
1361 0       30        2        2        1 
1362 0       11        1        2        1 
1363 1       39        1        2        1 
1364 0       32        1        2        1 
1365 0       17        1        2        1 
1366 0        3        3        2        1 
1367 0        7        3        2        0 
1368 0        2        2        2        0 
1369 1       64        2        2        1 
1370 1       13        1        2        2 
1371 1       15        2        2        1 
1372 0       48        2        2        1 
1373 0       23        1        2        1 
1374 1       48        1        2        0 
1375 0       25        1        2        1 
1376 0       12        1        2        1 
1377 1       46        1        2        1 
1378 0       79        1        2        1 
1379 0       56        1        2        1 
1380 0        8        1        2        1 
1381 1       29        3        1        0 
1382 1       35        3        1        0 
1383 1       11        3        1        0 
1384 0       69        3        1        1 
1385 1       21        3        1        0 
1386 0       13        3        1        0 
1387 0       21        1        1        1 
1388 1       32        1        1        1 
1389 1       24        1        1        0 
1390 0       24        1        1        1 
1391 0       73        1        1        1 
1392 0       42        1        1        1 
1393 1       34        1        1        1 
1394 0       30        2        1        0 
1395 0        7        2        1        0 
1396 1       29        3        1        0 
1397 1       22        3        1        0 
1398 0       38        2        1        1 
1399 0       13        2        1        1 
1400 0       12        2        1        1 
1401 0       42        3        1        0 
1402 1       17        3        1        0 
1403 0       21        3        1        1 
1404 0       34        1        1        1 
1405 0        1        3        1        0 
1406 0       14        2        1        0 
1407 0       16        2        1        0 
1408 0        9        3        1        0 
1409 0       53        3        1        0 
1410 0       27        3        1        0 
1411 0       15        3        1        0 
1412 0        9        3        1        0 
1413 0        4        2        1        1 
1414 0       10        3        1        1 
1415 0       31        3        1        0 
1416 0       85        3        1        1 
1417 0       24        2        1        0 
1418 end data.
1419
1420 logistic regression 
1421     disease WITH age sciostat sector savings
1422     /categorical = sciostat sector
1423     /print = ci(95).
1424 ])
1425
1426 AT_CHECK([pspp -O format=csv ci.sps], [0], [dnl
1427 Table: Dependent Variable Encoding
1428 Original Value,Internal Value
1429 .000,0
1430 1.000,1
1431
1432 Table: Case Processing Summary
1433 Unweighted Cases,N,Percent
1434 Included in Analysis,196,100.000
1435 Missing Cases,0,.000
1436 Total,196,100.000
1437
1438 note: Estimation terminated at iteration number 4 because parameter estimates changed by less than 0.001
1439
1440 Table: Model Summary
1441 Step 1,-2 Log likelihood,Cox & Snell R Square,Nagelkerke R Square
1442 ,211.195,.120,.172
1443
1444 Table: Categorical Variables' Codings
1445 ,,,Parameter coding,
1446 ,,Frequency,(1),(2)
1447 sciostat,1.000,77,1,0
1448 ,2.000,49,0,1
1449 ,3.000,70,0,0
1450 sector,1.000,117,1,
1451 ,2.000,79,0,
1452
1453 Table: Classification Table
1454 ,,,Predicted,,
1455 ,,,disease,,"Percentage
1456 Correct"
1457 ,Observed,,.000,1.000,
1458 Step 1,disease,.000,131,8,94.245
1459 ,,1.000,41,16,28.070
1460 ,Overall Percentage,,,,75.000
1461
1462 Table: Variables in the Equation
1463 ,,,,,,,,95% CI for Exp(B),
1464 ,,B,S.E.,Wald,df,Sig.,Exp(B),Lower,Upper
1465 Step 1,age,.027,.009,8.647,1,.003,1.027,1.009,1.045
1466 ,savings,.061,.386,.025,1,.874,1.063,.499,2.264
1467 ,sciostat,,,.440,2,.803,,,
1468 ,sciostat(1),-.278,.434,.409,1,.522,.757,.323,1.775
1469 ,sciostat(2),-.219,.459,.227,1,.634,.803,.327,1.976
1470 ,sector,,,11.974,1,.001,,,
1471 ,sector(1),-1.235,.357,11.974,1,.001,.291,.145,.586
1472 ,Constant,-.814,.452,3.246,1,.072,.443,,
1473 ])
1474
1475 AT_CLEANUP
1476