1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
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.
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.
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/>.
17 AT_BANNER([MEANS procedure])
19 AT_SETUP([MEANS simple example])
20 AT_KEYWORDS([categorical categoricals])
22 AT_DATA([means-simple.sps], [dnl
25 data list notable list /score * factor *.
55 MEANS TABLES = score BY factor.
58 AT_CHECK([pspp -O format=csv means-simple.sps], [0],
60 Table: Case Processing Summary
62 ,Included,,Excluded,,Total,
63 ,N,Percent,N,Percent,N,Percent
64 score: factor,26,100.0%,0,.0%,26,100.0%
65 score: ,26,100.0%,0,.0%,26,100.0%
68 ,factor,Mean,N,Std. Deviation
69 score,1.00000,19.78947,19.00000,4.03566
70 ,2.00000,24.00000,7.00000,5.50757
73 ,Mean,N,Std. Deviation
74 score,20.92308,26.00000,4.75750
81 AT_SETUP([MEANS very simple example])
82 AT_KEYWORDS([categorical categoricals])
84 AT_DATA([means-vsimple.sps], [dnl
87 data list notable list /score.
98 AT_CHECK([pspp -O format=csv means-vsimple.sps], [0],
100 Table: Case Processing Summary
102 ,Included,,Excluded,,Total,
103 ,N,Percent,N,Percent,N,Percent
104 score: ,4,100.0%,0,.0%,4,100.0%
107 ,Mean,N,Std. Deviation
108 score,1.50000,4.00000,.57735
116 AT_SETUP([MEANS default missing])
117 AT_KEYWORDS([categorical categoricals])
119 AT_DATA([means-dmiss.sps], [dnl
121 data list notable list /a * g1 * g2 *.
140 AT_CHECK([pspp -O format=csv means-dmiss.sps], [0],
142 Table: Case Processing Summary
144 ,Included,,Excluded,,Total,
145 ,N,Percent,N,Percent,N,Percent
146 a: g1 × g2,6,75.0%,2,25.0%,8,100.0%
147 a: g2,6,75.0%,2,25.0%,8,100.0%
148 a: ,7,87.5%,1,12.5%,8,100.0%
152 a,1.00,11.00,4.00,1.00
171 AT_SETUP([MEANS linear stats])
172 AT_KEYWORDS([categorical categoricals])
174 dnl Slightly more involved example to test the linear statistics
175 AT_DATA([means-linear.sps], [dnl
177 data list notable list /id * group * test1 *
191 add value labels /group 1 "experimental group" 2 "control group".
194 /cells = mean count stddev sum min max range variance kurt skew
199 AT_CHECK([pspp -O format=csv means-linear.sps], [0],
201 Table: Case Processing Summary
203 ,Included,,Excluded,,Total,
204 ,N,Percent,N,Percent,N,Percent
205 test1: group,10,100.0%,0,.0%,10,100.0%
206 test1: ,10,100.0%,0,.0%,10,100.0%
209 ,group,Mean,N,Std. Deviation,Sum,Min,Max,Range,Variance,Kurtosis,Skewness
210 test1,experimental group,86.2000,5.0000,8.9833,431.0000,75.0000,99.0000,24.0000,80.7000,.2727,.3858
211 ,control group,61.8000,5.0000,10.0598,309.0000,50.0000,71.0000,21.0000,101.2000,-3.0437,-.4830
214 ,Mean,N,Std. Deviation,Sum,Min,Max,Range,Variance,Kurtosis,Skewness
215 test1,74.0000,10.0000,15.6915,740.0000,50.0000,99.0000,49.0000,246.2222,-.5759,-.1262
221 AT_SETUP([MEANS standard errors])
222 AT_KEYWORDS([categorical categoricals])
224 AT_DATA([means-stderr.sps], [dnl
226 data list notable list /id * group * test1 *
241 /cells = mean count semean seskew sekurt.
245 AT_CHECK([pspp -O format=csv means-stderr.sps], [0],
247 Table: Case Processing Summary
249 ,Included,,Excluded,,Total,
250 ,N,Percent,N,Percent,N,Percent
251 test1: group,10,100.0%,0,.0%,10,100.0%
252 test1: ,10,100.0%,0,.0%,10,100.0%
255 ,group,Mean,N,S.E. Mean,S.E. Skew,S.E. Kurt
256 test1,1.0000,83.5000,6.0000,4.2485,.8452,1.7408
257 ,2.0000,59.7500,4.0000,5.1700,1.0142,2.6186
260 ,Mean,N,S.E. Mean,S.E. Skew,S.E. Kurt
261 test1,74.0000,10.0000,4.9621,.6870,1.3342
268 AT_SETUP([MEANS harmonic and geometric means])
269 AT_KEYWORDS([categorical categoricals])
271 AT_DATA([means-hg.sps], [dnl
273 data list notable list /x * y *.
284 /cells = mean harmonic geometric
289 AT_CHECK([pspp -O format=csv means-hg.sps], [0],
291 Table: Case Processing Summary
293 ,Included,,Excluded,,Total,
294 ,N,Percent,N,Percent,N,Percent
295 x: ,5,100.0%,0,.0%,5,100.0%
296 y: ,5,100.0%,0,.0%,5,100.0%
299 ,Mean,Harmonic Mean,Geom. Mean
300 x,3.0000,2.1898,2.6052
301 y,3.0000,3.0000,3.0000
311 AT_SETUP([MEANS all/none/default])
312 AT_KEYWORDS([categorical categoricals])
314 dnl Make sure that /CELLS = {ALL,NONE,DEFAULT} work properly
315 AT_DATA([means-stat-keywords.sps], [dnl
319 DATA LIST NOTABLE LIST /score *.
328 MEANS score /CELLS = ALL.
329 MEANS score /CELLS = DEFAULT.
330 MEANS score /CELLS = NONE.
334 AT_CHECK([pspp -O format=csv means-stat-keywords.sps], [0],
336 Table: Case Processing Summary
338 ,Included,,Excluded,,Total,
339 ,N,Percent,N,Percent,N,Percent
340 score: ,5,100.0%,0,.0%,5,100.0%
343 ,Mean,N,Std. Deviation,S.E. Mean,Sum,Min,Max,Range,Variance,Kurtosis,S.E. Kurt,Skewness,S.E. Skew,First,Last,Harmonic Mean,Geom. Mean
344 score,22.40,5.00,4.62,2.06,112.00,16.00,29.00,13.00,21.30,1.85,2.00,.11,.91,22.00,23.00,21.61,22.01
346 Table: Case Processing Summary
348 ,Included,,Excluded,,Total,
349 ,N,Percent,N,Percent,N,Percent
350 score: ,5,100.0%,0,.0%,5,100.0%
353 ,Mean,N,Std. Deviation
354 score,22.40,5.00,4.62
356 Table: Case Processing Summary
358 ,Included,,Excluded,,Total,
359 ,N,Percent,N,Percent,N,Percent
360 score: ,5,100.0%,0,.0%,5,100.0%
370 AT_SETUP([MEANS missing=table ])
371 AT_KEYWORDS([categorical categoricals])
373 AT_DATA([means-miss-table.sps], [dnl
374 data list notable list /a * b * g1.
398 AT_CHECK([pspp -o pspp.csv -o pspp.txt means-miss-table.sps])
399 AT_CHECK([cat pspp.csv], [0], [dnl
400 Table: Case Processing Summary
402 ,Included,,Excluded,,Total,
403 ,N,Percent,N,Percent,N,Percent
404 a: g1,7,100.0%,0,.0%,7,100.0%
405 a: ,7,100.0%,0,.0%,7,100.0%
406 b: g1,6,85.7%,1,14.3%,7,100.0%
407 b: ,6,85.7%,1,14.3%,7,100.0%
421 Table: Case Processing Summary
423 ,Included,,Excluded,,Total,
424 ,N,Percent,N,Percent,N,Percent
425 a: g1,7,100.0%,0,.0%,7,100.0%
426 a: ,7,100.0%,0,.0%,7,100.0%
437 Table: Case Processing Summary
439 ,Included,,Excluded,,Total,
440 ,N,Percent,N,Percent,N,Percent
441 a: g1,7,100.0%,0,.0%,7,100.0%
442 a: ,7,100.0%,0,.0%,7,100.0%
443 b: g1,6,85.7%,1,14.3%,7,100.0%
444 b: ,6,85.7%,1,14.3%,7,100.0%
458 Table: Case Processing Summary
460 ,Included,,Excluded,,Total,
461 ,N,Percent,N,Percent,N,Percent
462 a: g1,7,100.0%,0,.0%,7,100.0%
463 a: ,7,100.0%,0,.0%,7,100.0%
476 AT_SETUP([MEANS user missing values])
477 AT_KEYWORDS([categorical categoricals])
479 AT_DATA([means-missing.sps], [dnl
480 data list notable list /a * b * g1.
491 MISSING VALUES a b g1 (9).
493 MEANS a b BY g1 /cells = COUNT .
495 MEANS a b BY g1 /cells = COUNT /missing = include .
497 MEANS a b BY g1 /cells = COUNT /missing = dependent .
501 AT_CHECK([pspp -o pspp.csv -o pspp.txt means-missing.sps])
502 AT_CHECK([cat pspp.csv], [0], [dnl
503 Table: Case Processing Summary
505 ,Included,,Excluded,,Total,
506 ,N,Percent,N,Percent,N,Percent
507 a: g1,6,85.7%,1,14.3%,7,100.0%
508 a: ,7,100.0%,0,.0%,7,100.0%
509 b: g1,5,71.4%,2,28.6%,7,100.0%
510 b: ,6,85.7%,1,14.3%,7,100.0%
524 Table: Case Processing Summary
526 ,Included,,Excluded,,Total,
527 ,N,Percent,N,Percent,N,Percent
528 a: g1,7,100.0%,0,.0%,7,100.0%
529 a: ,7,100.0%,0,.0%,7,100.0%
530 b: g1,7,100.0%,0,.0%,7,100.0%
531 b: ,7,100.0%,0,.0%,7,100.0%
547 Table: Case Processing Summary
549 ,Included,,Excluded,,Total,
550 ,N,Percent,N,Percent,N,Percent
551 a: g1,7,100.0%,0,.0%,7,100.0%
552 a: ,7,100.0%,0,.0%,7,100.0%
553 b: g1,6,85.7%,1,14.3%,7,100.0%
554 b: ,6,85.7%,1,14.3%,7,100.0%
574 AT_SETUP([MEANS empty factor spec])
575 AT_KEYWORDS([categorical categoricals])
577 AT_DATA([means-bad.sps], [dnl
578 data list list /outcome *.
585 MEANS TABLES = outcome
589 AT_CHECK([pspp -O format=csv means-bad.sps], [1], [ignore])
595 AT_SETUP([MEANS parser bug])
596 AT_KEYWORDS([categorical categoricals])
598 dnl This bug caused an infinite loop
599 AT_DATA([means-bad.sps], [dnl
600 DATA LIST notable LIST /a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 fylo *.
602 1 2 3 4 5 6 7 8 9 0 11
605 MEANS TABLES = a1 a2 a3 a4 a5 a6 a7 a8 a9 a10a BY fylo.
608 AT_CHECK([pspp -O format=csv means-bad.sps], [1], [ignore])