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/>.
19 AT_SETUP([GRAPH simple scatterplot])
20 AT_DATA([scatterplot.sps],[
21 * Simple Scatterplot test
25 COMPUTE Age = RV.NORMAL(40,10).
31 COMPUTE Size = Age * 3 + 50.
34 /SCATTERPLOT(BIVARIATE) = Age WITH Size.
38 AT_CHECK([pspp -O format=csv scatterplot.sps], [0], [ignore])
43 AT_SETUP([GRAPH Scatter and Histogram])
45 AT_DATA([scatterlong.sps],[
49 COMPUTE Age = RV.NORMAL(40,10).
50 COMPUTE CityNum = TRUNC(UNIFORM(2.95)).
56 COMPUTE Size = Age * 3 + 50 + 50*CityNum.
67 /SCATTERPLOT(BIVARIATE) = Age WITH Size
70 /SCATTERPLOT(BIVARIATE) = Age WITH CityNum
73 /SCATTERPLOT = CityNum WITH Age
76 /SCATTERPLOT = CityNum WITH Size
79 /SCATTERPLOT(BIVARIATE) = Age WITH Size BY City
82 /SCATTERPLOT(BIVARIATE) = Age WITH Size BY CityNum
85 /CityNum 1 'Rio' 2 'Tokyo' 0 'Mumbai'.
88 /SCATTERPLOT(BIVARIATE) = Age WITH Size BY CityNum
95 AT_CHECK([pspp -O format=pdf scatterlong.sps], [0], [ignore])
98 AT_SETUP([GRAPH missing values don't crash])
99 AT_DATA([scatter.sps], [dnl
100 data list list /x * y *.
111 /scatterplot = x with y.
115 AT_CHECK([pspp -o pspp.pdf scatter.sps])
116 dnl Ignore output -- this is just a no-crash check.
119 AT_SETUP([GRAPH missing=VARIABLE no crash])
120 AT_DATA([scatter.sps], [dnl
121 data list list /x * y *.
132 /scatterplot = x with y
138 AT_CHECK([pspp -o pspp.pdf scatter.sps])
139 dnl Ignore output -- this is just a no-crash check.
142 AT_SETUP([GRAPH missing value in by variable])
143 AT_DATA([scatter.sps], [dnl
144 data list list /x * y * z *.
155 /scatterplot = x with y by z
159 /scatterplot = x with y by z.
162 AT_CHECK([pspp -o pspp.pdf scatter.sps])
163 dnl Ignore output -- this is just a no-crash check.
167 AT_SETUP([GRAPH histogram with null data])
168 AT_DATA([null-hist.sps], [dnl
180 AT_CHECK([pspp -o pspp.pdf null-hist.sps], [0], [ignore])
181 dnl Ignore output -- this is just a no-crash check.
185 AT_SETUP([GRAPH histogram all missing])
186 AT_DATA([null-hist.sps], [dnl
197 AT_CHECK([pspp null-hist.sps], [0], [ignore])
198 dnl Ignore output -- this is just a no-crash check.
204 AT_SETUP([GRAPH barcharts])
205 AT_CHECK([ln -s $top_srcdir/examples/physiology.sav .], [0])
206 AT_CHECK([ln -s $top_srcdir/examples/repairs.sav .], [0])
208 AT_DATA([barchart.sps], [dnl
209 GET FILE="physiology.sav".
211 GRAPH /BAR = COUNT BY SEX.
213 GRAPH /BAR = MEAN(height) BY SEX.
217 GET FILE="repairs.sav".
219 GRAPH /BAR = MEAN (mtbf) BY factory.
221 COMPUTE R = TRUNC(RV.UNIFORM(1,5)).
223 GRAPH /BAR = MEAN (mtbf) BY factory BY R.
226 AT_CHECK([pspp -o pspp.pdf barchart.sps], [0], [ignore])
227 dnl Ignore output -- this is just a no-crash check.
233 AT_SETUP([GRAPH barchart arity])
235 AT_DATA([barchart.sps], [dnl
236 data list notable list /x y z*.
250 * This line is invalid
251 GRAPH /BAR = COUNT(x) BY y.
254 AT_CHECK([pspp -o pspp.pdf barchart.sps], [1], [ignore])
255 dnl Ignore output -- this is just a no-crash check.
262 AT_SETUP([GRAPH barchart bad syntax])
264 AT_DATA([barchart.sps], [dnl
265 data list notable list /x y z*.
279 * This line is invalid
280 GRAPH /BAR = SCROD BY y.
283 AT_CHECK([pspp -o pspp.pdf barchart.sps], [1], [ignore])
284 dnl Ignore output -- this is just a no-crash check.
290 AT_SETUP([GRAPH barchart full])
292 AT_DATA([barchart.sps], [dnl
293 data list notable list /x y z*.
307 * This line is invalid
308 GRAPH /BAR = COUNT by z.
309 GRAPH /BAR = CUFREQ by z.
310 GRAPH /BAR = PCT by z.
311 GRAPH /BAR = CUPCT by z.
313 GRAPH /BAR = MEAN(y) BY z.
314 GRAPH /BAR = SUM(y) BY z.
315 GRAPH /BAR = MAXIMUM(y) BY z.
316 GRAPH /BAR = MINIMUM(y) BY z.
318 GRAPH /BAR = MEAN(y) BY z BY y.
319 GRAPH /BAR = SUM(y) BY z BY y.
320 GRAPH /BAR = MAXIMUM(y) BY z BY y.
321 GRAPH /BAR = MINIMUM(y) BY z BY y.
324 AT_CHECK([pspp -o pspp.pdf barchart.sps], [0], [ignore])
325 dnl Ignore output -- this is just a no-crash check.
333 AT_SETUP([GRAPH buggy syntax])
335 AT_DATA([barchart.sps], [dnl
336 data list notable list /x y z*.
343 GRAPH /BAR = MINIMUM({) BY z BY y.
346 AT_CHECK([pspp -o pspp.pdf barchart.sps], [1], [ignore])
347 dnl Ignore output -- this is just a no-crash check.
352 dnl Check that percentages are calculated with respect to the
353 dnl proper total. See bug #56247
354 AT_SETUP([GRAPH barchart percentage sub-categorical])
355 AT_DATA([barchart.sps], [dnl
356 data list list notable /penalty_favopp_x * XYdem_racethW8 * w *.
372 * /tables=penalty_favopp_x by XYdem_racethW8
373 * /format=AVALUE TABLES PIVOT
375 * /cells COUNT COLUMN TOTAL.
378 /bar=pct by penalty_favopp_x
382 /bar=pct by penalty_favopp_x by XYdem_racethW8
386 AT_CHECK([pspp --testing barchart.sps], [0], [dnl
390 Primary Categories: 4
391 Largest Category: 53.1634
393 Y Label: "Percentage"
394 Categorical Variables:
395 Var: "penalty_favopp_x"
402 Count: 53.1634; Cat: " 1.00"
403 Count: 18.7756; Cat: " 2.00"
404 Count: 12.1074; Cat: " 4.00"
405 Count: 15.9536; Cat: " 5.00"
410 Primary Categories: 4
411 Largest Category: 57.0929
413 Y Label: "Percentage"
414 Categorical Variables:
415 Var: "penalty_favopp_x"
416 Var: "XYdem_racethW8"
426 Count: 57.0929; Cat: " 1.00", " .00"
427 Count: 39.1259; Cat: " 1.00", " 1.00"
428 Count: 19.7495; Cat: " 2.00", " .00"
429 Count: 15.2966; Cat: " 2.00", " 1.00"
430 Count: 10.7195; Cat: " 4.00", " .00"
431 Count: 17.0656; Cat: " 4.00", " 1.00"
432 Count: 12.4381; Cat: " 5.00", " .00"
433 Count: 28.512; Cat: " 5.00", " 1.00"