dnl of the 2nd and 3rd variables. We use this for weight testing.
AT_SETUP([LOGISTIC REGRESSION basic test])
dnl of the 2nd and 3rd variables. We use this for weight testing.
AT_SETUP([LOGISTIC REGRESSION basic test])
-AT_CHECK([pspp -O format=csv lr-data.sps], [0],
- [dnl
-Table: Dependent Variable Encoding
+AT_CHECK([pspp -o pspp.csv -o pspp.txt lr-data.sps], [0], [dnl
+note: Estimation terminated at iteration number 6 because parameter estimates changed by less than 0.001
+])
+AT_CHECK([cat pspp.csv], [0], [Table: Dependent Variable Encoding
Table: Case Processing Summary
Unweighted Cases,N,Percent
Table: Case Processing Summary
Unweighted Cases,N,Percent
-Step 1,-2 Log likelihood,Cox & Snell R Square,Nagelkerke R Square
-,37.323,.455,.659
+Step,-2 Log likelihood,Cox & Snell R Square,Nagelkerke R Square
+1,37.323,.455,.659
-Step 1,outcome,1.000,43,5,89.583
-,,2.000,4,14,77.778
-,Overall Percentage,,,,86.364
+Step 1,outcome,1.000,43,5,89.6%
+,,2.000,4,14,77.8%
+,Overall Percentage,,,,86.4%
Table: Variables in the Equation
,,B,S.E.,Wald,df,Sig.,Exp(B)
Step 1,survrate,-.081,.019,17.756,1,.000,.922
,Constant,2.684,.811,10.941,1,.001,14.639
])
Table: Variables in the Equation
,,B,S.E.,Wald,df,Sig.,Exp(B)
Step 1,survrate,-.081,.019,17.756,1,.000,.922
,Constant,2.684,.811,10.941,1,.001,14.639
])
dnl Only the summary information should be different
AT_CHECK([diff run0 run1], [1], [dnl
8,10c8,10
dnl Only the summary information should be different
AT_CHECK([diff run0 run1], [1], [dnl
8,10c8,10
dnl To do this, the same data set is used, one weighted, one not.
dnl The weighted dataset omits certain cases which are identical
AT_SETUP([LOGISTIC REGRESSION weights])
dnl To do this, the same data set is used, one weighted, one not.
dnl The weighted dataset omits certain cases which are identical
AT_SETUP([LOGISTIC REGRESSION weights])
dnl this displays the unweighted totals.
AT_CHECK([diff unweighted-result weighted-result], [1], [dnl
8c8
dnl this displays the unweighted totals.
AT_CHECK([diff unweighted-result weighted-result], [1], [dnl
8c8
-> Total,63,100.000
-23,24c23,24
-< Step 1,outcome,1.000,43,5,89.583
-< ,,2.000,4,14,77.778
+> Total,63,100.0%
+22,23c22,23
+< Step 1,outcome,1.000,43,5,89.6%
+< ,,2.000,4,14,77.8%
-> Step 1,outcome,1.000,43.000,5.000,89.583
-> ,,2.000,4.000,14.000,77.778
+> Step 1,outcome,1.000,43.000,5.000,89.6%
+> ,,2.000,4.000,14.000,77.8%
dnl The results this produces are very similar to those
dnl at the example in http://www.ats.ucla.edu/stat/SPSS/faq/logregconst.htm
AT_SETUP([LOGISTIC REGRESSION without constant])
dnl The results this produces are very similar to those
dnl at the example in http://www.ats.ucla.edu/stat/SPSS/faq/logregconst.htm
AT_SETUP([LOGISTIC REGRESSION without constant])
Table: Dependent Variable Encoding
Original Value,Internal Value
Table: Dependent Variable Encoding
Original Value,Internal Value
Table: Case Processing Summary
Unweighted Cases,N,Percent
Table: Case Processing Summary
Unweighted Cases,N,Percent
-Step 1,-2 Log likelihood,Cox & Snell R Square,Nagelkerke R Square
-,275.637,.008,.011
+Step,-2 Log likelihood,Cox & Snell R Square,Nagelkerke R Square
+1,275.637,.008,.011
-Step 1,female,.00,0,91,.000
-,,1.00,0,109,100.000
-,Overall Percentage,,,,54.500
+Step 1,female,.00,0,91,.0%
+,,1.00,0,109,100.0%
+,Overall Percentage,,,,54.5%
Table: Variables in the Equation
,,B,S.E.,Wald,df,Sig.,Exp(B)
Table: Variables in the Equation
,,B,S.E.,Wald,df,Sig.,Exp(B)
dnl Check that if somebody passes a dependent variable which is not dichtomous,
dnl then an error is raised.
AT_SETUP([LOGISTIC REGRESSION non-dichotomous dep var])
dnl Check that if somebody passes a dependent variable which is not dichtomous,
dnl then an error is raised.
AT_SETUP([LOGISTIC REGRESSION non-dichotomous dep var])
AT_DATA([non-dich.sps], [dnl
data list notable list /y x1 x2 x3 x4.
AT_DATA([non-dich.sps], [dnl
data list notable list /y x1 x2 x3 x4.
dnl variable. This examṕle was inspired from that at:
dnl http://www.ats.ucla.edu/stat/spss/dae/logit.htm
AT_SETUP([LOGISTIC REGRESSION with categorical])
dnl variable. This examṕle was inspired from that at:
dnl http://www.ats.ucla.edu/stat/spss/dae/logit.htm
AT_SETUP([LOGISTIC REGRESSION with categorical])
Table: Dependent Variable Encoding
Original Value,Internal Value
Table: Dependent Variable Encoding
Original Value,Internal Value
Table: Case Processing Summary
Unweighted Cases,N,Percent
Table: Case Processing Summary
Unweighted Cases,N,Percent
-Step 1,-2 Log likelihood,Cox & Snell R Square,Nagelkerke R Square
-,458.517,.098,.138
+Step,-2 Log likelihood,Cox & Snell R Square,Nagelkerke R Square
+1,458.517,.098,.138
-Step 1,y,4.000,254,19,93.040
-,,9.000,97,30,23.622
-,Overall Percentage,,,,71.000
+Step 1,y,4.000,254,19,93.0%
+,,9.000,97,30,23.6%
+,Overall Percentage,,,,71.0%
Table: Variables in the Equation
,,B,S.E.,Wald,df,Sig.,Exp(B)
Table: Variables in the Equation
,,B,S.E.,Wald,df,Sig.,Exp(B)
,bcat(3),.211,.393,.289,1,.591,1.235
,Constant,-5.541,1.138,23.709,1,.000,.004
])
,bcat(3),.211,.393,.289,1,.591,1.235
,Constant,-5.541,1.138,23.709,1,.000,.004
])
AT_CLEANUP
dnl This example is inspired by http://www.ats.ucla.edu/stat/spss/output/logistic.htm
AT_SETUP([LOGISTIC REGRESSION with cat var 2])
AT_CLEANUP
dnl This example is inspired by http://www.ats.ucla.edu/stat/spss/output/logistic.htm
AT_SETUP([LOGISTIC REGRESSION with cat var 2])
Table: Dependent Variable Encoding
Original Value,Internal Value
Table: Dependent Variable Encoding
Original Value,Internal Value
Table: Case Processing Summary
Unweighted Cases,N,Percent
Table: Case Processing Summary
Unweighted Cases,N,Percent
-Step 1,-2 Log likelihood,Cox & Snell R Square,Nagelkerke R Square
-,165.701,.280,.408
+Step,-2 Log likelihood,Cox & Snell R Square,Nagelkerke R Square
+1,165.701,.280,.408
-Step 1,honcomp,.000,132,15,89.796
-,,1.000,26,27,50.943
-,Overall Percentage,,,,79.500
+Step 1,honcomp,.000,132,15,89.8%
+,,1.000,26,27,50.9%
+,Overall Percentage,,,,79.5%
Table: Variables in the Equation
,,B,S.E.,Wald,df,Sig.,Exp(B)
Table: Variables in the Equation
,,B,S.E.,Wald,df,Sig.,Exp(B)
dnl Check that it doesn't crash if a categorical variable
dnl has only one distinct value
AT_SETUP([LOGISTIC REGRESSION identical categories])
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*.
AT_DATA([crash.sps], [dnl
data list notable list /y x1 x2*.
dnl Test that missing values on the categorical predictors are treated
dnl properly.
AT_SETUP([LOGISTIC REGRESSION missing categoricals])
dnl Test that missing values on the categorical predictors are treated
dnl properly.
AT_SETUP([LOGISTIC REGRESSION missing categoricals])
dnl one point. The data in this example comes from:
dnl http://people.ysu.edu/~gchang/SPSSE/SPSS_lab2Regression.pdf
AT_SETUP([LOGISTIC REGRESSION confidence interval])
dnl one point. The data in this example comes from:
dnl http://people.ysu.edu/~gchang/SPSSE/SPSS_lab2Regression.pdf
AT_SETUP([LOGISTIC REGRESSION confidence interval])
AT_CHECK([pspp -O format=csv ci.sps], [0], [dnl
Table: Dependent Variable Encoding
Original Value,Internal Value
AT_CHECK([pspp -O format=csv ci.sps], [0], [dnl
Table: Dependent Variable Encoding
Original Value,Internal Value
Table: Case Processing Summary
Unweighted Cases,N,Percent
Table: Case Processing Summary
Unweighted Cases,N,Percent
-Step 1,-2 Log likelihood,Cox & Snell R Square,Nagelkerke R Square
-,211.195,.120,.172
+Step,-2 Log likelihood,Cox & Snell R Square,Nagelkerke R Square
+1,211.195,.120,.172
-Step 1,disease,.000,131,8,94.245
-,,1.000,41,16,28.070
-,Overall Percentage,,,,75.000
+Step 1,disease,.000,131,8,94.2%
+,,1.000,41,16,28.1%
+,Overall Percentage,,,,75.0%
-,,,,,,,,95% CI for Exp(B),
-,,B,S.E.,Wald,df,Sig.,Exp(B),Lower,Upper
+,,B,S.E.,Wald,df,Sig.,Exp(B),95% CI for Exp(B),
+,,,,,,,,Lower,Upper
Step 1,age,.027,.009,8.647,1,.003,1.027,1.009,1.045
,savings,.061,.386,.025,1,.874,1.063,.499,2.264
,sciostat,,,.440,2,.803,,,
Step 1,age,.027,.009,8.647,1,.003,1.027,1.009,1.045
,savings,.061,.386,.025,1,.874,1.063,.499,2.264
,sciostat,,,.440,2,.803,,,