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/>.
16 dnl AT_BANNER([FREQUENCIES procedure])
18 AT_SETUP([FREQUENCIES string variable])
19 AT_DATA([frequencies.sps],
21 name (A8) value * quantity .
36 FREQUENCIES /VAR = name/ORDER=ANALYSIS.
38 AT_CHECK([pspp -O format=csv frequencies.sps], [0], [dnl
40 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
41 ,bar ,2,20.00,20.00,20.00
42 ,baz ,4,40.00,40.00,60.00
43 ,foo ,2,20.00,20.00,80.00
44 ,quux ,2,20.00,20.00,100.00
45 Total,,10,100.0,100.0,
49 # Tests for a bug where pspp would crash if two FREQUENCIES commands
50 # existed in a input file.
51 AT_SETUP([FREQUENCIES two runs crash])
52 AT_DATA([frequencies.sps],
53 [data list free /v1 v2.
61 frequencies v1 v2/statistics=none/ORDER=VARIABLE.
62 frequencies v1 v2/statistics=none.
64 AT_CHECK([pspp -O format=csv frequencies.sps], [0],
66 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
67 ,.00,1,25.00,25.00,25.00
68 ,2.00,1,25.00,25.00,50.00
69 ,3.00,1,25.00,25.00,75.00
70 ,4.00,1,25.00,25.00,100.00
74 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
75 ,1.00,1,25.00,25.00,25.00
76 ,3.00,1,25.00,25.00,50.00
77 ,4.00,1,25.00,25.00,75.00
78 ,5.00,1,25.00,25.00,100.00
82 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
83 ,.00,1,25.00,25.00,25.00
84 ,2.00,1,25.00,25.00,50.00
85 ,3.00,1,25.00,25.00,75.00
86 ,4.00,1,25.00,25.00,100.00
90 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
91 ,1.00,1,25.00,25.00,25.00
92 ,3.00,1,25.00,25.00,50.00
93 ,4.00,1,25.00,25.00,75.00
94 ,5.00,1,25.00,25.00,100.00
99 # Test that the LIMIT specification works.
100 AT_SETUP([FREQUENCIES with LIMIT])
101 AT_DATA([frequencies.sps],
102 [data list free /v1 v2.
110 frequencies v1 v2/statistics=none/FORMAT=LIMIT(3).
112 AT_CHECK([pspp -O format=csv frequencies.sps], [0], [dnl
114 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
115 ,1.00,1,25.00,25.00,25.00
116 ,3.00,1,25.00,25.00,50.00
117 ,5.00,2,50.00,50.00,100.00
118 Total,,4,100.0,100.0,
122 # Tests for a bug where PSPP would crash when a FREQUENCIES command
123 # was used with the HTML output driver.
124 AT_SETUP([FREQUENCIES HTML output crash])
125 AT_DATA([frequencies.sps],
126 [data list free /v1 v2.
136 frequencies v1/statistics=none.
138 AT_CHECK([pspp -o - -O format=csv -o pspp.html frequencies.sps], [0],
147 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
148 ,.00,1,25.00,25.00,25.00
149 ,2.00,1,25.00,25.00,50.00
150 ,3.00,1,25.00,25.00,75.00
151 ,4.00,1,25.00,25.00,100.00
152 Total,,4,100.0,100.0,
154 AT_CHECK([test -s pspp.html])
157 # Tests for a bug which crashed PSPP when a piechart with too many
158 # segments was requested.
159 AT_SETUP([FREQUENCIES pie chart crash])
160 AT_DATA([frequencies.sps],
161 [data list list /x * w *.
178 frequencies /x /format=notable /statistics=none
181 # Cannot use the CSV driver for this because it does not output charts
183 AT_CHECK([pspp frequencies.sps], [0], [dnl
184 Reading free-form data from INLINE.
194 dnl Check that histogram subcommand runs wihout crashing
195 AT_SETUP([FREQUENCIES histogram crash])
196 AT_DATA([frequencies.sps],
197 [data list notable list /x * w *.
217 /histogram=minimum(0) maximum(50) percent(5) normal.
219 # Cannot use the CSV driver for this because it does not output charts
221 AT_CHECK([pspp -O format=pdf frequencies.sps], [0], [ignore])
224 # Tests for a bug which crashed PSPP when the median and a histogram
225 # were both requested.
226 AT_SETUP([FREQUENCIES median with histogram crash])
227 AT_DATA([frequencies.sps], [dnl
228 data list list notable /x.
233 frequencies /x /histogram /STATISTICS=median.
235 AT_CHECK([pspp -O format=csv frequencies.sps], [0], [ignore])
236 dnl Ignore output - No crash test.
239 # Tests for a bug which caused FREQUENCIES following TEMPORARY to
240 # crash (bug #11492).
241 AT_SETUP([FREQUENCIES crash after TEMPORARY])
242 AT_DATA([frequencies.sps],
243 [DATA LIST LIST /SEX (A1) X *.
262 AT_CHECK([pspp -O format=csv frequencies.sps], [0],
263 [Table: Reading free-form data from INLINE.
269 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
270 ,12.00,1,25.00,25.00,25.00
271 ,13.00,1,25.00,25.00,50.00
272 ,21.00,1,25.00,25.00,75.00
273 ,31.00,1,25.00,25.00,100.00
274 Total,,4,100.0,100.0,
286 m4_define([FREQUENCIES_NTILES_OUTPUT],
302 AT_SETUP([FREQUENCIES basic percentiles])
303 AT_DATA([frequencies.sps],
304 [DATA LIST LIST notable /x * .
316 /PERCENTILES = 0 25 33.333 50 66.666 75 100.
318 AT_CHECK([pspp -O format=csv frequencies.sps], [0],
319 [FREQUENCIES_NTILES_OUTPUT])
322 AT_SETUP([FREQUENCIES basic n-tiles])
323 AT_DATA([frequencies.sps],
324 [DATA LIST LIST notable /x * .
339 AT_CHECK([pspp -O format=csv frequencies.sps], [0],
340 [FREQUENCIES_NTILES_OUTPUT])
343 AT_SETUP([FREQUENCIES compatibility percentiles])
344 AT_DATA([frequencies.sps],
345 [DATA LIST LIST notable /X * .
356 /ALGORITHM=COMPATIBLE
357 /PERCENTILES = 0 25 50 75 100.
359 AT_CHECK([pspp -O format=csv frequencies.sps], [0],
361 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
362 ,1.00,1,20.00,20.00,20.00
363 ,2.00,1,20.00,20.00,40.00
364 ,3.00,1,20.00,20.00,60.00
365 ,4.00,1,20.00,20.00,80.00
366 ,5.00,1,20.00,20.00,100.00
367 Total,,5,100.0,100.0,
384 AT_SETUP([FREQUENCIES enhanced percentiles])
385 AT_DATA([frequencies.sps],
386 [DATA LIST LIST notable /X * .
397 /PERCENTILES = 0 25 50 75 100.
399 AT_CHECK([pspp -O format=csv frequencies.sps], [0],
401 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
402 ,1.00,1,20.00,20.00,20.00
403 ,2.00,1,20.00,20.00,40.00
404 ,3.00,1,20.00,20.00,60.00
405 ,4.00,1,20.00,20.00,80.00
406 ,5.00,1,20.00,20.00,100.00
407 Total,,5,100.0,100.0,
424 AT_SETUP([FREQUENCIES enhanced percentiles, weighted])
425 AT_DATA([frequencies.sps],
426 [DATA LIST LIST notable /X * F *.
441 /PERCENTILES = 0 25 50 75 100.
443 AT_CHECK([pspp -O format=csv frequencies.sps], [0],
445 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
446 ,1.00,2.00,20.00,20.00,20.00
447 ,2.00,2.00,20.00,20.00,40.00
448 ,3.00,2.00,20.00,20.00,60.00
449 ,4.00,2.00,20.00,20.00,80.00
450 ,5.00,2.00,20.00,20.00,100.00
451 Total,,10.00,100.0,100.0,
468 AT_SETUP([FREQUENCIES enhanced percentiles, weighted (2)])
469 AT_DATA([frequencies.sps],
470 [DATA LIST LIST notable /X * F *.
483 /PERCENTILES = 0 25 50 75 100.
485 AT_CHECK([pspp -O format=csv frequencies.sps], [0],
487 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
488 ,1.00,1.00,16.67,16.67,16.67
489 ,3.00,2.00,33.33,33.33,50.00
490 ,4.00,1.00,16.67,16.67,66.67
491 ,5.00,2.00,33.33,33.33,100.00
492 Total,,6.00,100.0,100.0,
509 dnl Data for this test case from Fabio Bordignon <bordignon@demos.it>.
510 AT_SETUP([FREQUENCIES enhanced percentiles, weighted (3)])
511 AT_DATA([frequencies.sps],
512 [DATA LIST LIST notable /X * F *.
524 /PERCENTILES = 0 25 50 75 100.
526 AT_CHECK([pspp -O format=csv frequencies.sps], [0], [dnl
528 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
529 ,1.00,7.00,17.50,17.50,17.50
530 ,2.00,16.00,40.00,40.00,57.50
531 ,3.00,12.00,30.00,30.00,87.50
532 ,4.00,5.00,12.50,12.50,100.00
533 Total,,40.00,100.0,100.0,
550 AT_SETUP([FREQUENCIES enhanced percentiles, weighted, missing values])
551 AT_DATA([frequencies.sps],
552 [DATA LIST LIST notable /X * F *.
562 MISSING VALUE x (99.0) .
567 /PERCENTILES = 0 25 50 75 100.
570 AT_CHECK([pspp -O format=csv frequencies.sps], [0],
572 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
573 ,1.00,1.00,10.00,16.67,16.67
574 ,3.00,2.00,20.00,33.33,50.00
575 ,4.00,1.00,10.00,16.67,66.67
576 ,5.00,2.00,20.00,33.33,100.00
577 ,99.00,4.00,40.00,Missing,
578 Total,,10.00,100.0,100.0,
595 AT_SETUP([FREQUENCIES dichotomous histogram])
596 AT_DATA([frequencies.sps], [dnl
597 data list notable list /d4 *.
625 AT_CHECK([pspp frequencies.sps], [0], [ignore])
629 AT_SETUP([FREQUENCIES median])
630 AT_DATA([median.sps], [dnl
631 data list notable list /x *.
644 AT_CHECK([pspp median.sps -O format=csv], [0], [dnl
646 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
647 ,1.00,1,33.33,33.33,33.33
648 ,2.00,1,33.33,33.33,66.67
649 ,3000000.00,1,33.33,33.33,100.00
650 Total,,3,100.0,100.0,
655 Percentiles,50 (Median),2.00
659 AT_SETUP([FREQUENCIES variance])
660 AT_DATA([variance.sps], [dnl
661 data list notable list /forename (A12) height.
671 /STATISTICS = VARIANCE.
674 AT_CHECK([pspp variance.sps -O format=csv], [0], [dnl
676 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
677 ,109.00,1,25.00,25.00,25.00
678 ,134.00,1,25.00,25.00,50.00
679 ,167.00,1,25.00,25.00,75.00
680 ,188.00,1,25.00,25.00,100.00
681 Total,,4,100.0,100.0,
690 AT_SETUP([FREQUENCIES default statistics])
691 AT_DATA([median.sps], [dnl
692 data list notable list /x *.
706 /STATISTICS = DEFAULT
710 AT_CHECK([pspp median.sps -O format=csv], [0], [dnl
712 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
713 ,10.00,1,33.33,33.33,33.33
714 ,20.00,1,33.33,33.33,66.67
715 ,3000000.00,1,33.33,33.33,100.00
716 Total,,3,100.0,100.0,
727 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
728 ,10.00,1,33.33,33.33,33.33
729 ,20.00,1,33.33,33.33,66.67
730 ,3000000.00,1,33.33,33.33,100.00
731 Total,,3,100.0,100.0,
745 AT_SETUP([FREQUENCIES no valid data])
746 AT_DATA([empty.sps], [dnl
747 data list notable list /x *.
760 AT_CHECK([pspp empty.sps -O format=csv], [0], [dnl
762 Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
763 ,. ,3,100.00,Missing,
764 Total,,3,100.0,100.0,
788 AT_SETUP([FREQUENCIES histogram no valid cases])
789 AT_DATA([empty.sps], [dnl
790 data list notable list /x w *.
805 AT_CHECK([pspp empty.sps -O format=csv], [0], [ignore])
809 AT_SETUP([FREQUENCIES percentiles + histogram bug#48128])
810 AT_DATA([bug.sps], [dnl
815 COMPUTE SCORE=EXP(NORMAL(1)).
821 FREQUENCIES VARIABLES=SCORE
824 /PERCENTILES=1 10 20 30 40 50 60 70 80 90 99
829 AT_CHECK([pspp bug.sps], [0], [ignore])