51d74e2eb725af9b8a43c51d83b470a775d475f6
[pspp-builds.git] / tests / language / stats / means.at
1 AT_BANNER([MEANS procedure])
2
3 AT_SETUP([MEANS simple example])
4
5 AT_DATA([means-simple.sps], [dnl
6 SET FORMAT=F12.5.
7
8 data list notable list /score * factor *.
9 BEGIN DATA.
10 22 01
11 22 01
12 29 01
13 16 01
14 24 02
15 21 02
16 22 01
17 24 01
18 19 01
19 17 01
20 22 01
21 17 02
22 23 02
23 25 02
24 20 01
25 15 01
26 18 01
27 26 01
28 23 02
29 35 02
30 20 01
31 16 01
32 19 01
33 14 01
34 14 01
35 21 01
36 END DATA.
37
38 MEANS TABLES = score BY factor.
39 ])
40
41 AT_CHECK([pspp -O format=csv means-simple.sps], [0],
42   [dnl
43 Table: Case Processing Summary
44 ,Cases,,,,,
45 ,Included,,Excluded,,Total,
46 ,N,Percent,N,Percent,N,Percent
47 score: factor,26,100%,0,0%,26,100%
48
49 Table: Report
50 ,factor,Mean,N,Std. Deviation
51 score,1.00000,19.78947,19.00000,4.03566
52 ,2.00000,24.00000,7.00000,5.50757
53 ])
54
55 AT_CLEANUP
56
57
58
59 AT_SETUP([MEANS very simple example])
60
61 AT_DATA([means-vsimple.sps], [dnl
62 SET FORMAT=F12.5.
63
64 data list notable list /score.
65 begin data.
66 1
67 1
68 2
69 2
70 end data.
71
72 means tables = score.
73 ])
74
75 AT_CHECK([pspp -O format=csv means-vsimple.sps], [0],
76   [dnl
77 Table: Case Processing Summary
78 ,Cases,,,,,
79 ,Included,,Excluded,,Total,
80 ,N,Percent,N,Percent,N,Percent
81 score: ,4,100%,0,0%,4,100%
82
83 Table: Report
84 ,Mean,N,Std. Deviation
85 score,1.50000,4.00000,.57735
86 ])
87
88 AT_CLEANUP
89
90
91
92
93 AT_SETUP([MEANS default missing])
94
95 AT_DATA([means-dmiss.sps], [dnl
96 SET FORMAT=F12.2.
97 data list notable list /a * g1 * g2 *.
98 begin data.
99 3 1 . 
100 4 1 11
101 3 1 21
102 6 2 21
103 2 2 31
104 . 2 31
105 8 2 31
106 7 2 31
107 end data.
108
109 MEANS TABLES = 
110       a BY g1
111       a BY g2
112       /cells = MEAN COUNT
113       .
114 ])
115
116 AT_CHECK([pspp -O format=csv means-dmiss.sps], [0],
117   [dnl
118 Table: Case Processing Summary
119 ,Cases,,,,,
120 ,Included,,Excluded,,Total,
121 ,N,Percent,N,Percent,N,Percent
122 a: g1 * g2,6,75%,2,25%,8,100%
123 a: a * g2,6,75%,2,25%,8,100%
124
125 Table: Report
126 ,g1,g2,Mean,N
127 a,1.00,11.00,4.00,1.00
128 ,1.00,21.00,3.00,1.00
129 ,2.00,21.00,6.00,1.00
130 ,2.00,31.00,5.67,3.00
131
132 Table: Report
133 ,a,g2,Mean,N
134 a,2.00,31.00,2.00,1.00
135 ,3.00,21.00,3.00,1.00
136 ,4.00,11.00,4.00,1.00
137 ,6.00,21.00,6.00,1.00
138 ,7.00,31.00,7.00,1.00
139 ,8.00,31.00,8.00,1.00
140 ])
141
142 AT_CLEANUP
143
144
145 AT_SETUP([MEANS linear stats])
146
147 dnl Slightly more involved example to test the linear statistics
148 AT_DATA([means-linear.sps], [dnl
149 set format F12.4.
150 data list notable list /id * group * test1 *
151 begin data.
152 1 1 85
153 2 1 90
154 3 1 82
155 4 1 75
156 5 1 99
157 6 2 70
158 7 2 66
159 8 2 52
160 9 2 71
161 10 2 50
162 end data.
163
164 add value labels /group 1 "experimental group" 2 "control group".
165
166 means test1 by group
167   /cells = mean count stddev sum min max range variance kurt skew
168   .
169 ])
170
171
172 AT_CHECK([pspp -O format=csv means-linear.sps], [0],
173   [dnl
174 Table: Case Processing Summary
175 ,Cases,,,,,
176 ,Included,,Excluded,,Total,
177 ,N,Percent,N,Percent,N,Percent
178 test1: group,10,100%,0,0%,10,100%
179
180 Table: Report
181 ,group,Mean,N,Std. Deviation,Sum,Min,Max,Range,Variance,Kurtosis,Skewness
182 test1,experimental group,86.2000,5.0000,8.9833,431.0000,75.0000,99.0000,24.0000,80.7000,.2727,.3858
183 ,control group,61.8000,5.0000,10.0598,309.0000,50.0000,71.0000,21.0000,101.2000,-3.0437,-.4830
184 ])
185
186 AT_CLEANUP
187
188
189 AT_SETUP([MEANS standard errors])
190
191 AT_DATA([means-stderr.sps], [dnl
192 set format F12.4.
193 data list notable list /id * group * test1 *
194 begin data.
195 1 1 85
196 2 1 90
197 3 1 82
198 4 1 75
199 5 1 99
200 6 1 70
201 7 2 66
202 8 2 52
203 9 2 71
204 10 2 50
205 end data.
206
207 means test1 by group 
208         /cells = mean count semean seskew sekurt.
209 ])
210
211
212 AT_CHECK([pspp -O format=csv means-stderr.sps], [0],
213   [dnl
214 Table: Case Processing Summary
215 ,Cases,,,,,
216 ,Included,,Excluded,,Total,
217 ,N,Percent,N,Percent,N,Percent
218 test1: group,10,100%,0,0%,10,100%
219
220 Table: Report
221 ,group,Mean,N,S.E. Mean,S.E. Skew,S.E. Kurt
222 test1,1.0000,83.5000,6.0000,4.2485,.8452,1.7408
223 ,2.0000,59.7500,4.0000,5.1700,1.0142,2.6186
224 ])
225
226 AT_CLEANUP
227
228
229
230 AT_SETUP([MEANS harmonic and geometric means])
231
232 AT_DATA([means-hg.sps], [dnl
233 set format F12.4.
234 data list notable list /x * y *.
235 begin data.
236 1 3
237 2 3
238 3 3
239 4 3
240 5 3
241 end data.
242
243
244 means x y
245         /cells = mean harmonic geometric
246 .
247 ])
248
249
250 AT_CHECK([pspp -O format=csv means-hg.sps], [0],
251   [dnl
252 Table: Case Processing Summary
253 ,Cases,,,,,
254 ,Included,,Excluded,,Total,
255 ,N,Percent,N,Percent,N,Percent
256 x: ,5,100%,0,0%,5,100%
257 y: ,5,100%,0,0%,5,100%
258
259 Table: Report
260 ,Mean,Harmonic Mean,Geom. Mean
261 x,3.0000,2.1898,2.6052
262 y,3.0000,3.0000,3.0000
263 ])
264
265 AT_CLEANUP