ROC: Convert tests to Autotest framework.
[pspp-builds.git] / tests / language / stats / roc.at
1 AT_BANNER([ROC])
2
3 AT_SETUP([ROC, free distribution])
4 AT_DATA([roc.sps], [dnl
5 set format F10.3.
6 data list notable list /x * y * w * a *.
7 begin data.
8 1 1 2  1
9 1 2 28 0
10 2 3 4  1
11 2 4 14 0
12 3 5 10 1
13 . . 1  0
14 3 1 5  0
15 4 2 14 1
16 4 3 2  0
17 5 4 20 1
18 5 4 20 .
19 5 5 1  0
20 end data.
21
22 weight by w.
23
24 roc x by a (1)
25         /plot = none
26         /print = se coordinates
27         /criteria = testpos(large) distribution(free) ci(99)
28         /missing = exclude .
29 ])
30 AT_CHECK([pspp -o pspp.csv roc.sps])
31 AT_CHECK([cat pspp.csv], [0], [dnl
32 Table: Case Summary
33 ,Valid N (listwise),
34 a,Unweighted,Weighted
35 Positive,5,50.000
36 Negative,5,50.000
37
38 Table: Area Under the Curve (x)
39 ,,,Asymp. 99% Confidence Interval,
40 Area,Std. Error,Asymptotic Sig.,Lower Bound,Upper Bound
41 .910,.030,.000,.839,.981
42
43 Table: Coordinates of the Curve (x)
44 Positive if greater than or equal to,Sensitivity,1 - Specificity
45 .000,1.000,1.000
46 1.500,.960,.440
47 2.500,.880,.160
48 3.500,.680,.060
49 4.500,.400,.020
50 6.000,.000,.000
51 ])
52 AT_CLEANUP
53
54 AT_SETUP([ROC, negative exponential distribution])
55 AT_DATA([roc.sps], [dnl
56 set format F10.3.
57 data list notable list /x * y * w * a *.
58 begin data.
59 1 1 2  1
60 1 2 28 0
61 2 3 4  1
62 2 4 14 0
63 3 5 10 1
64 . . 1  0
65 3 1 5  0
66 4 2 14 1
67 4 3 2  0
68 5 4 20 1
69 5 4 20 .
70 5 5 1  0
71 end data.
72
73 weight by w.
74
75 roc x y by a (1)
76         /plot = curve(reference)
77         /print = se coordinates
78         /criteria = testpos(large) distribution(negexpo) ci(95)
79         /missing = exclude .
80 ])
81 AT_CHECK([pspp -o pspp.csv roc.sps])
82 AT_CHECK([cat pspp.csv], [0], [dnl
83 Table: Case Summary
84 ,Valid N (listwise),
85 a,Unweighted,Weighted
86 Positive,5,50.000
87 Negative,5,50.000
88
89 Table: Area Under the Curve
90 ,,,,Asymp. 95% Confidence Interval,
91 Variable under test,Area,Std. Error,Asymptotic Sig.,Lower Bound,Upper Bound
92 x,.910,.030,.000,.860,.960
93 y,.697,.052,.001,.611,.783
94
95 Table: Coordinates of the Curve
96 Test variable,Positive if greater than or equal to,Sensitivity,1 - Specificity
97 x,.000,1.000,1.000
98 ,1.500,.960,.440
99 ,2.500,.880,.160
100 ,3.500,.680,.060
101 ,4.500,.400,.020
102 ,6.000,.000,.000
103 y,.000,1.000,1.000
104 ,1.500,.960,.900
105 ,2.500,.680,.340
106 ,3.000,.600,.340
107 ,3.500,.600,.300
108 ,4.500,.200,.020
109 ,6.000,.000,.000
110 ])
111 AT_CLEANUP
112
113 AT_SETUP([ROC, with anomaly])
114 AT_DATA([roc.sps], [dnl
115 set format F10.3.
116 data list notable list /x * a * comment (a20).
117 begin data.
118 0  1 ""
119 0  0 ""
120 1  1 ""
121 1  0 ""
122 2  1 ""
123 2  0 ""
124 5  1 ""
125 5  0 ""
126 10 1 ""
127 10 0 ""
128 15 1 ""
129 15 0 ""
130 20 1 ""
131 20 1 ""
132 22 0 "here and"
133 22 0 "here is the anomoly"
134 25 1 ""
135 25 0 ""
136 30 1 ""
137 30 0 ""
138 35 1 ""
139 35 0 ""
140 38 1 ""
141 38 0 ""
142 39 1 ""
143 39 0 ""
144 40 1 ""
145 40 0 ""
146 end data.
147
148 roc x by a (1)
149         /plot = none
150         print = se 
151         .
152 ])
153 AT_CHECK([pspp -o pspp.csv roc.sps])
154 AT_CHECK([cat pspp.csv], [0], [dnl
155 Table: Case Summary
156 ,Valid N (listwise),
157 a,Unweighted,Weighted
158 Positive,14,14.000
159 Negative,14,14.000
160
161 Table: Area Under the Curve (x)
162 ,,,Asymp. 95% Confidence Interval,
163 Area,Std. Error,Asymptotic Sig.,Lower Bound,Upper Bound
164 .490,.111,.927,.307,.673
165 ])
166 AT_CLEANUP