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([DESCRIPTIVES procedure])
18 AT_SETUP([DESCRIPTIVES basics])
19 AT_DATA([descriptives.sps],
20 [title 'Test DESCRIPTIVES procedure'.
22 data list / V0 to V16 1-17.
36 descript all/stat=all/format=serial.
38 AT_CHECK([pspp -O format=csv descriptives.sps], [0],
39 [Title: Test DESCRIPTIVES procedure
41 Table: Reading 1 record from INLINE.
42 Variable,Record,Columns,Format
61 Table: Valid cases = 10; cases with missing value(s) = 0.
62 Variable,Valid N,Missing N,Mean,S.E. Mean,Std Dev,Variance,Kurtosis,S.E. Kurt,Skewness,S.E. Skew,Range,Minimum,Maximum,Sum
63 V0,10,0,3.80,.84,2.66,7.07,-.03,1.33,.89,.69,8.00,1.00,9.00,38.00
64 V1,10,0,4.60,.96,3.03,9.16,-1.39,1.33,-.03,.69,9.00,.00,9.00,46.00
65 V2,10,0,4.10,1.16,3.67,13.43,-2.02,1.33,.48,.69,8.00,1.00,9.00,41.00
66 V3,10,0,4.10,.87,2.77,7.66,-2.05,1.33,.42,.69,7.00,1.00,8.00,41.00
67 V4,10,0,7.00,.47,1.49,2.22,7.15,1.33,-2.52,.69,5.00,3.00,8.00,70.00
68 V5,10,0,4.90,1.03,3.25,10.54,-1.40,1.33,-.20,.69,9.00,.00,9.00,49.00
69 V6,10,0,5.90,.80,2.51,6.32,-.29,1.33,-.96,.69,7.00,1.00,8.00,59.00
70 V7,10,0,4.70,1.10,3.47,12.01,-1.99,1.33,-.16,.69,9.00,.00,9.00,47.00
71 V8,10,0,4.10,1.10,3.48,12.10,-1.93,1.33,.37,.69,9.00,.00,9.00,41.00
72 V9,10,0,4.30,.87,2.75,7.57,-.87,1.33,.73,.69,8.00,1.00,9.00,43.00
73 V10,10,0,5.50,.85,2.68,7.17,-1.84,1.33,-.33,.69,7.00,2.00,9.00,55.00
74 V11,10,0,6.50,.78,2.46,6.06,-1.28,1.33,-.89,.69,6.00,3.00,9.00,65.00
75 V12,10,0,7.90,.60,1.91,3.66,5.24,1.33,-2.21,.69,6.00,3.00,9.00,79.00
76 V13,10,0,4.30,.99,3.13,9.79,-1.25,1.33,.33,.69,9.00,.00,9.00,43.00
77 V14,10,0,3.60,1.01,3.20,10.27,-.96,1.33,.81,.69,9.00,.00,9.00,36.00
78 V15,10,0,3.70,.92,2.91,8.46,-1.35,1.33,.71,.69,7.00,1.00,8.00,37.00
79 V16,10,0,6.40,.91,2.88,8.27,-1.14,1.33,-.92,.69,7.00,2.00,9.00,64.00
83 m4_define([DESCRIPTIVES_MISSING_DATA],
84 [data list notable / V1 TO V3 1-3.
97 AT_SETUP([DESCRIPTIVES -- excluding missing data])
98 AT_DATA([descriptives.sps],
99 [DESCRIPTIVES_MISSING_DATA
100 descript all/stat=all/format=serial.
102 AT_CHECK([pspp -O format=csv descriptives.sps], [0],
103 [Table: Valid cases = 7; cases with missing value(s) = 6.
104 Variable,Valid N,Missing N,Mean,S.E. Mean,Std Dev,Variance,Kurtosis,S.E. Kurt,Skewness,S.E. Skew,Range,Minimum,Maximum,Sum
105 V1,1,6,2.00,. ,. ,. ,. ,. ,. ,. ,.00,2.00,2.00,2.00
106 V2,2,5,2.50,.50,.71,.50,. ,. ,. ,. ,1.00,2.00,3.00,5.00
107 V3,3,4,3.00,.58,1.00,1.00,. ,. ,.00,1.22,2.00,2.00,4.00,9.00
111 AT_SETUP([DESCRIPTIVES -- including missing data])
112 AT_DATA([descriptives.sps],
113 [DESCRIPTIVES_MISSING_DATA
114 descript all/stat=all/format=serial/missing=include.
116 AT_CHECK([pspp -O format=csv descriptives.sps], [0],
117 [Table: Valid cases = 7; cases with missing value(s) = 3.
118 Variable,Valid N,Missing N,Mean,S.E. Mean,Std Dev,Variance,Kurtosis,S.E. Kurt,Skewness,S.E. Skew,Range,Minimum,Maximum,Sum
119 V1,5,2,1.20,.20,.45,.20,5.00,2.00,2.24,.91,1.00,1.00,2.00,6.00
120 V2,5,2,1.60,.40,.89,.80,.31,2.00,1.26,.91,2.00,1.00,3.00,8.00
121 V3,5,2,2.20,.58,1.30,1.70,-1.49,2.00,.54,.91,3.00,1.00,4.00,11.00
125 AT_SETUP([DESCRIPTIVES -- excluding missing data listwise])
126 AT_DATA([descriptives.sps],
127 [DESCRIPTIVES_MISSING_DATA
128 descript all/stat=all/format=serial/missing=listwise.
130 AT_CHECK([pspp -O format=csv descriptives.sps], [0],
131 [Table: Valid cases = 1; cases with missing value(s) = 6.
132 Variable,Valid N,Missing N,Mean,S.E. Mean,Std Dev,Variance,Kurtosis,S.E. Kurt,Skewness,S.E. Skew,Range,Minimum,Maximum,Sum
133 V1,1,0,2.00,. ,. ,. ,. ,. ,. ,. ,.00,2.00,2.00,2.00
134 V2,1,0,3.00,. ,. ,. ,. ,. ,. ,. ,.00,3.00,3.00,3.00
135 V3,1,0,4.00,. ,. ,. ,. ,. ,. ,. ,.00,4.00,4.00,4.00
139 AT_SETUP([DESCRIPTIVES -- including missing data listwise])
140 AT_DATA([descriptives.sps],
141 [DESCRIPTIVES_MISSING_DATA
142 descript all/stat=all/format=serial/missing=listwise include.
144 AT_CHECK([pspp -O format=csv descriptives.sps], [0],
145 [Table: Valid cases = 4; cases with missing value(s) = 3.
146 Variable,Valid N,Missing N,Mean,S.E. Mean,Std Dev,Variance,Kurtosis,S.E. Kurt,Skewness,S.E. Skew,Range,Minimum,Maximum,Sum
147 V1,4,0,1.25,.25,.50,.25,4.00,2.62,2.00,1.01,1.00,1.00,2.00,5.00
148 V2,4,0,1.75,.48,.96,.92,-1.29,2.62,.85,1.01,2.00,1.00,3.00,7.00
149 V3,4,0,2.50,.65,1.29,1.67,-1.20,2.62,.00,1.01,3.00,1.00,4.00,10.00
153 AT_SETUP([DESCRIPTIVES bug calculating mean only])
154 AT_DATA([descriptives.sps],
157 data list notable / X 1.
167 descript all/stat=mean.
169 AT_CHECK([pspp -O format=csv descriptives.sps], [0],
170 [Table: Valid cases = 6; cases with missing value(s) = 0.
176 dnl Git history shows that this was probably a bug in the PSPP
177 dnl core regarding multipass procedures, not anything specific
179 AT_SETUP([DESCRIPTIVES bug with TEMPORARY])
180 AT_DATA([descriptives.sps], [dnl
181 DATA LIST LIST NOTABLE /id * abc *.
195 DESCRIPTIVES /VAR=abc.
197 AT_CHECK([pspp -O format=csv descriptives.sps], [0], [dnl
198 Table: Valid cases = 6; cases with missing value(s) = 0.
199 Variable,N,Mean,Std Dev,Minimum,Maximum
200 abc,6,3.00,.84,2.00,4.00
204 AT_SETUP([DESCRIPTIVES -- Z scores])
205 AT_DATA([descriptives.sps], [dnl
206 DATA LIST LIST NOTABLE /a b.
213 DESCRIPTIVES /VAR=a b /SAVE.
216 AT_CHECK([pspp -O format=csv descriptives.sps], [0], [dnl
217 Table: Mapping of variables to corresponding Z-scores.
222 Table: Valid cases = 3; cases with missing value(s) = 0.
223 Variable,N,Mean,Std Dev,Minimum,Maximum
224 a,3,2.00,1.00,1.00,3.00
225 b,3,60.00,10.00,50.00,70.00
229 1.00,50.00,-1.00,-1.00
235 AT_SETUP([DESCRIPTIVES -- Z scores with SPLIT FILE])
236 AT_DATA([descriptives.sps], [dnl
237 DATA LIST LIST NOTABLE /group a b.
249 DESCRIPTIVES /VAR=a b /SAVE.
252 AT_CHECK([pspp -O format=csv descriptives.sps], [0], [dnl
253 Table: Mapping of variables to corresponding Z-scores.
261 Table: Valid cases = 3; cases with missing value(s) = 0.
262 Variable,N,Mean,Std Dev,Minimum,Maximum
263 a,3,2.00,1.00,1.00,3.00
264 b,3,60.00,10.00,50.00,70.00
269 Table: Valid cases = 4; cases with missing value(s) = 0.
270 Variable,N,Mean,Std Dev,Minimum,Maximum
271 a,4,300.00,182.57,100.00,500.00
272 b,4,8000.00,1825.74,6000.00,10000.00
279 1.00,1.00,50.00,-1.00,-1.00
280 1.00,2.00,60.00,.00,.00
281 1.00,3.00,70.00,1.00,1.00
288 2.00,100.00,6000.00,-1.10,-1.10
289 2.00,200.00,7000.00,-.55,-.55
290 2.00,400.00,9000.00,.55,.55
291 2.00,500.00,10000.00,1.10,1.10
295 dnl Ideally DESCRIPTIVES would not make temporary transformations permanent
296 dnl as it does now (bug #38786), so these results are imperfect. However,
297 dnl this test does verify that DESCRIPTIVES does not crash in this situation
298 dnl (as it once did).
299 AT_SETUP([DESCRIPTIVES -- Z scores bug with TEMPORARY])
300 AT_DATA([descriptives.sps], [dnl
301 DATA LIST LIST NOTABLE /id abc.
315 DESCRIPTIVES /VAR=abc/SAVE.
318 AT_CHECK([pspp -O format=csv descriptives.sps], [0], [dnl
319 descriptives.sps:15: warning: DESCRIPTIVES: DESCRIPTIVES with Z scores ignores TEMPORARY. Temporary transformations will be made permanent.
321 Table: Mapping of variables to corresponding Z-scores.
325 Table: Valid cases = 6; cases with missing value(s) = 0.
326 Variable,N,Mean,Std Dev,Minimum,Maximum
327 abc,6,3.00,.84,2.00,4.00
340 dnl This test was supplied by Mindaugus as part of the report for bug #42012.
341 AT_SETUP([DESCRIPTIVES -- Z scores with FILTER])
342 AT_DATA([descriptives.sps], [dnl
343 DATA LIST LIST/filter1 filter2 x.
357 DESCRIPTIVES /VARIABLES=X /SAVE.
361 DESCRIPTIVES /VARIABLES=X /SAVE.
364 SORT CASES BY filter1.
365 SPLIT FILE BY filter1.
366 DESCRIPTIVES /VARIABLES=X /SAVE.
369 SPLIT FILE BY filter1.
370 DESCRIPTIVES /VARIABLES=X /SAVE.
373 SORT CASES BY filter1 filter2.
374 SPLIT FILE BY filter1 filter2.
375 DESCRIPTIVES /VARIABLES=X /SAVE.
381 AT_CHECK([pspp -o pspp.csv descriptives.sps])
382 AT_CHECK([sed -n '/Table: Data List/,$p' < pspp.csv], [0], [dnl
384 filter1,filter2,x,Zx,ZSC001,ZSC002,ZSC003,ZSC004
385 .00,.00,300.00,1.94,. ,1.00,. ,. @&t@
386 .00,1.00,200.00,1.07,. ,.00,.71,.71
387 .00,1.00,100.00,.20,. ,-1.00,-.71,-.71
388 1.00,.00,5.00,-.62,1.26,1.26,. ,.71
389 1.00,.00,4.00,-.63,.63,.63,. ,-.71
390 1.00,1.00,3.00,-.64,.00,.00,1.00,1.00
391 1.00,1.00,2.00,-.65,-.63,-.63,.00,.00
392 1.00,1.00,1.00,-.66,-1.26,-1.26,-1.00,-1.00