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([GRAPH])
18 AT_SETUP([GRAPH simple scatterplot])
19 AT_DATA([scatterplot.sps],[
20 * Simple Scatterplot test
24 COMPUTE Age = RV.NORMAL(40,10).
30 COMPUTE Size = Age * 3 + 50.
33 /SCATTERPLOT(BIVARIATE) = Age WITH Size.
37 AT_CHECK([pspp -O format=csv scatterplot.sps], [0], [ignore])
42 AT_SETUP([GRAPH Scatter and Histogram])
43 AT_DATA([scatterlong.sps],[
47 COMPUTE Age = RV.NORMAL(40,10).
48 COMPUTE CityNum = TRUNC(UNIFORM(2.95)).
54 COMPUTE Size = Age * 3 + 50 + 50*CityNum.
65 /SCATTERPLOT(BIVARIATE) = Age WITH Size
68 /SCATTERPLOT(BIVARIATE) = Age WITH CityNum
71 /SCATTERPLOT = CityNum WITH Age
74 /SCATTERPLOT = CityNum WITH Size
77 /SCATTERPLOT(BIVARIATE) = Age WITH Size BY City
80 /SCATTERPLOT(BIVARIATE) = Age WITH Size BY CityNum
83 /CityNum 1 'Rio' 2 'Tokyo' 0 'Mumbai'.
86 /SCATTERPLOT(BIVARIATE) = Age WITH Size BY CityNum
93 AT_CHECK([pspp -O format=pdf scatterlong.sps], [0], [ignore])
96 AT_SETUP([GRAPH missing values don't crash])
97 AT_DATA([scatter.sps], [dnl
98 data list list /x * y *.
109 /scatterplot = x with y.
113 AT_CHECK([pspp -o pspp.pdf scatter.sps])
114 dnl Ignore output -- this is just a no-crash check.
117 AT_SETUP([GRAPH missing=VARIABLE no crash])
118 AT_DATA([scatter.sps], [dnl
119 data list list /x * y *.
130 /scatterplot = x with y
136 AT_CHECK([pspp -o pspp.pdf scatter.sps])
137 dnl Ignore output -- this is just a no-crash check.
140 AT_SETUP([GRAPH missing value in by variable])
141 AT_DATA([scatter.sps], [dnl
142 data list list /x * y * z *.
153 /scatterplot = x with y by z
157 /scatterplot = x with y by z.
160 AT_CHECK([pspp -o pspp.pdf scatter.sps])
161 dnl Ignore output -- this is just a no-crash check.
165 AT_SETUP([GRAPH histogram with null data])
166 AT_DATA([null-hist.sps], [dnl
178 AT_CHECK([pspp -o pspp.pdf null-hist.sps], [0], [ignore])
179 dnl Ignore output -- this is just a no-crash check.
183 AT_SETUP([GRAPH histogram all missing])
184 AT_DATA([null-hist.sps], [dnl
195 AT_CHECK([pspp null-hist.sps], [0], [ignore])
196 dnl Ignore output -- this is just a no-crash check.
202 AT_SETUP([GRAPH barcharts])
203 AT_CHECK([ln -s $top_srcdir/examples/physiology.sav .], [0])
204 AT_CHECK([ln -s $top_srcdir/examples/repairs.sav .], [0])
206 AT_DATA([barchart.sps], [dnl
207 GET FILE="physiology.sav".
209 GRAPH /BAR = COUNT BY SEX.
211 GRAPH /BAR = MEAN(height) BY SEX.
215 GET FILE="repairs.sav".
217 GRAPH /BAR = MEAN (mtbf) BY factory.
219 COMPUTE R = TRUNC(RV.UNIFORM(1,5)).
221 GRAPH /BAR = MEAN (mtbf) BY factory BY R.
224 AT_CHECK([pspp -o pspp.pdf barchart.sps], [0], [ignore])
225 dnl Ignore output -- this is just a no-crash check.
231 AT_SETUP([GRAPH barchart arity])
233 AT_DATA([barchart.sps], [dnl
234 data list notable list /x y z*.
248 * This line is invalid
249 GRAPH /BAR = COUNT(x) BY y.
252 AT_CHECK([pspp -o pspp.pdf barchart.sps], [1], [ignore])
253 dnl Ignore output -- this is just a no-crash check.
260 AT_SETUP([GRAPH barchart bad syntax])
262 AT_DATA([barchart.sps], [dnl
263 data list notable list /x y z*.
277 * This line is invalid
278 GRAPH /BAR = SCROD BY y.
281 AT_CHECK([pspp -o pspp.pdf barchart.sps], [1], [ignore])
282 dnl Ignore output -- this is just a no-crash check.
288 AT_SETUP([GRAPH barchart full])
290 AT_DATA([barchart.sps], [dnl
291 data list notable list /x y z*.
305 * This line is invalid
306 GRAPH /BAR = COUNT by z.
307 GRAPH /BAR = CUFREQ by z.
308 GRAPH /BAR = PCT by z.
309 GRAPH /BAR = CUPCT by z.
311 GRAPH /BAR = MEAN(y) BY z.
312 GRAPH /BAR = SUM(y) BY z.
313 GRAPH /BAR = MAXIMUM(y) BY z.
314 GRAPH /BAR = MINIMUM(y) BY z.
316 GRAPH /BAR = MEAN(y) BY z BY y.
317 GRAPH /BAR = SUM(y) BY z BY y.
318 GRAPH /BAR = MAXIMUM(y) BY z BY y.
319 GRAPH /BAR = MINIMUM(y) BY z BY y.
322 AT_CHECK([pspp -o pspp.pdf barchart.sps], [0], [ignore])
323 dnl Ignore output -- this is just a no-crash check.
331 AT_SETUP([GRAPH buggy syntax])
333 AT_DATA([barchart.sps], [dnl
334 data list notable list /x y z*.
341 GRAPH /BAR = MINIMUM({) BY z BY y.
344 AT_CHECK([pspp -o pspp.pdf barchart.sps], [1], [ignore])
345 dnl Ignore output -- this is just a no-crash check.