Fix some typos (found by codespell)
[pspp] / tests / language / stats / roc.at
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
3 dnl 
4 dnl This program is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation, either version 3 of the License, or
7 dnl (at your option) any later version.
8 dnl 
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 dnl GNU General Public License for more details.
13 dnl 
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 dnl
17 AT_BANNER([ROC])
18
19 AT_SETUP([ROC, free distribution])
20 AT_DATA([roc.sps], [dnl
21 set format F10.3.
22 data list notable list /x * y * w * a *.
23 begin data.
24 1 1 2  1
25 1 2 28 0
26 2 3 4  1
27 2 4 14 0
28 3 5 10 1
29 . . 1  0
30 3 1 5  0
31 4 2 14 1
32 4 3 2  0
33 5 4 20 1
34 5 4 20 .
35 5 5 1  0
36 end data.
37
38 weight by w.
39
40 roc x by a (1)
41         /plot = none
42         /print = se coordinates
43         /criteria = testpos(large) distribution(free) ci(99)
44         /missing = exclude .
45 ])
46 AT_CHECK([pspp -o pspp.csv roc.sps])
47 AT_CHECK([cat pspp.csv], [0], [dnl
48 Table: Case Summary
49 ,Valid N (listwise),
50 a,Unweighted,Weighted
51 Positive,5,50.000
52 Negative,5,50.000
53
54 Table: Area Under the Curve (x)
55 ,,,Asymp. 99% Confidence Interval,
56 Area,Std. Error,Asymptotic Sig.,Lower Bound,Upper Bound
57 .910,.030,.000,.839,.981
58
59 Table: Coordinates of the Curve (x)
60 Positive if greater than or equal to,Sensitivity,1 - Specificity
61 .000,1.000,1.000
62 1.500,.960,.440
63 2.500,.880,.160
64 3.500,.680,.060
65 4.500,.400,.020
66 6.000,.000,.000
67 ])
68 AT_CLEANUP
69
70 AT_SETUP([ROC, negative exponential distribution])
71 AT_DATA([roc.sps], [dnl
72 set format F10.3.
73 data list notable list /x * y * w * a *.
74 begin data.
75 1 1 2  1
76 1 2 28 0
77 2 3 4  1
78 2 4 14 0
79 3 5 10 1
80 . . 1  0
81 3 1 5  0
82 4 2 14 1
83 4 3 2  0
84 5 4 20 1
85 5 4 20 .
86 5 5 1  0
87 end data.
88
89 weight by w.
90
91 roc x y by a (1)
92         /plot = curve(reference)
93         /print = se coordinates
94         /criteria = testpos(large) distribution(negexpo) ci(95)
95         /missing = exclude .
96 ])
97 AT_CHECK([pspp -o pspp.csv roc.sps])
98 AT_CHECK([cat pspp.csv], [0], [dnl
99 Table: Case Summary
100 ,Valid N (listwise),
101 a,Unweighted,Weighted
102 Positive,5,50.000
103 Negative,5,50.000
104
105 Table: Area Under the Curve
106 ,,,,Asymp. 95% Confidence Interval,
107 Variable under test,Area,Std. Error,Asymptotic Sig.,Lower Bound,Upper Bound
108 x,.910,.030,.000,.860,.960
109 y,.697,.052,.001,.611,.783
110
111 Table: Coordinates of the Curve
112 Test variable,Positive if greater than or equal to,Sensitivity,1 - Specificity
113 x,.000,1.000,1.000
114 ,1.500,.960,.440
115 ,2.500,.880,.160
116 ,3.500,.680,.060
117 ,4.500,.400,.020
118 ,6.000,.000,.000
119 y,.000,1.000,1.000
120 ,1.500,.960,.900
121 ,2.500,.680,.340
122 ,3.000,.600,.340
123 ,3.500,.600,.300
124 ,4.500,.200,.020
125 ,6.000,.000,.000
126 ])
127 AT_CLEANUP
128
129 AT_SETUP([ROC, with anomaly])
130 AT_DATA([roc.sps], [dnl
131 set format F10.3.
132 data list notable list /x * a * comment (a20).
133 begin data.
134 0  1 ""
135 0  0 ""
136 1  1 ""
137 1  0 ""
138 2  1 ""
139 2  0 ""
140 5  1 ""
141 5  0 ""
142 10 1 ""
143 10 0 ""
144 15 1 ""
145 15 0 ""
146 20 1 ""
147 20 1 ""
148 22 0 "here and"
149 22 0 "here is the anomaly"
150 25 1 ""
151 25 0 ""
152 30 1 ""
153 30 0 ""
154 35 1 ""
155 35 0 ""
156 38 1 ""
157 38 0 ""
158 39 1 ""
159 39 0 ""
160 40 1 ""
161 40 0 ""
162 end data.
163
164 roc x by a (1)
165         /plot = none
166         print = se 
167         .
168 ])
169 AT_CHECK([pspp -o pspp.csv roc.sps])
170 AT_CHECK([cat pspp.csv], [0], [dnl
171 Table: Case Summary
172 ,Valid N (listwise),
173 a,Unweighted,Weighted
174 Positive,14,14.000
175 Negative,14,14.000
176
177 Table: Area Under the Curve (x)
178 ,,,Asymp. 95% Confidence Interval,
179 Area,Std. Error,Asymptotic Sig.,Lower Bound,Upper Bound
180 .490,.111,.927,.307,.673
181 ])
182 AT_CLEANUP
183
184
185
186
187 AT_SETUP([ROC crash on no state variable])
188 AT_DATA([roc.sps], [dnl
189 data list notable list /x * y * w * a *.
190 begin data.
191 5 5 1  0
192 end data.
193
194
195 roc x y By(a (1)
196  .
197 ])
198
199 AT_CHECK([pspp -o pspp.csv roc.sps], [1], [ignore])
200
201 AT_CLEANUP
202
203
204 AT_SETUP([ROC crash on invalid syntax])
205 AT_DATA([roc.sps], [dnl
206 data list notable list /x * y * a *.
207 bggin data.
208 1 1 2  
209 1 2 28
210 end data.
211
212
213 roc x y by a (1)
214         /criteria = ci(y5)
215 ])
216
217 AT_CHECK([pspp -O format=csv roc.sps], [1], [ignore])
218
219 AT_CLEANUP