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([CORRELATIONS])
18 AT_SETUP([CORRELATIONS -- unweighted])
19 AT_DATA([correlations.sps], [dnl
21 data list notable list /foo * bar * wiz * bang *.
34 variables = foo bar wiz bang
46 variables = foo bar wiz bang
51 AT_CHECK([pspp -o pspp.csv correlations.sps])
52 AT_CHECK([cat pspp.csv], [0], [dnl
55 foo,Pearson Correlation,1.000,.802,.890,-.308
56 ,Sig. (2-tailed),,.055,.017,.553
57 bar,Pearson Correlation,.802,1.000,.519,.118
58 ,Sig. (2-tailed),.055,,.291,.824
59 wiz,Pearson Correlation,.890,.519,1.000,-.344
60 ,Sig. (2-tailed),.017,.291,,.505
61 bang,Pearson Correlation,-.308,.118,-.344,1.000
62 ,Sig. (2-tailed),.553,.824,.505,
66 bar,Pearson Correlation,1.000,.497
67 ,Sig. (2-tailed),,.210
68 wiz,Pearson Correlation,.497,1.000
69 ,Sig. (2-tailed),.210,
73 foo,Pearson Correlation,1.000,.805,.883,-.308
74 ,Sig. (2-tailed),,.029,.008,.553
76 bar,Pearson Correlation,.805,1.000,.497,.164
77 ,Sig. (2-tailed),.029,,.210,.725
79 wiz,Pearson Correlation,.883,.497,1.000,-.337
80 ,Sig. (2-tailed),.008,.210,,.460
82 bang,Pearson Correlation,-.308,.164,-.337,1.000
83 ,Sig. (2-tailed),.553,.725,.460,
88 AT_SETUP([CORRELATIONS -- weighted])
89 AT_DATA([correlations1.sps], [dnl
91 data list notable list /foo * bar * wiz * bang * w *.
104 variables = foo bar wiz bang
105 /statistics=descriptives xprod
108 AT_DATA([correlations2.sps], [dnl
110 data list notable list /foo * bar * wiz * bang * w *.
126 variables = foo bar wiz bang
127 /statistics=descriptives xprod
130 AT_CHECK([pspp -O format=csv correlations1.sps], [0], [stdout])
132 AT_CHECK([pspp -O format=csv correlations2.sps], [0], [expout])
136 AT_SETUP([CORRELATIONS -- non-square])
137 AT_DATA([corr-ns.sps], [dnl
139 data list notable list /foo * bar * wiz *.
150 variables = foo with bar wiz
154 AT_CHECK([pspp -O format=csv corr-ns.sps], [0], [dnl
157 foo,Pearson Correlation,1.000,-1.000
158 ,Sig. (2-tailed),.000,.000
164 dnl Checks for bug #38661.
165 AT_SETUP([CORRELATIONS -- crash with WITH keyword])
166 AT_DATA([correlations.sps], [dnl
167 DATA LIST LIST NOTABLE /a b c d e f g h i.
170 20 21 17 28 23 4.35 24 19 25
171 28 18 29 30 23 4.55 17 23 28
172 47 18 30 30 29 4.35 26 31 31
173 20 7 19 22 22 4.80 24 16 27
174 19 12 17 27 22 . 22 14 25
175 22 9 19 30 33 5 29 30 27
176 41 16 22 32 23 3.90 26 27 23
177 18 18 20 26 22 5.80 17 20 39
178 18 24 25 25 31 5.15 27 27 34
179 19 22 26 23 37 6 41 32 27
180 23 12 15 29 25 4.10 21 27 20
181 21 4 28 37 31 5.65 27 18 42
182 19 5 17 17 29 3.10 19 16 19
183 21 17 20 35 31 . 28 30 22
186 CORRELATIONS VARIABLE=a f b WITH c g h i e d/STATISTICS=DESCRIPTIVES.
188 AT_CHECK([pspp -o pspp.csv correlations.sps])
189 # Check the output, ignoring the actual correlations values since
190 # they look pretty nonsensical to me for this input (they include NaNs).
191 AT_CHECK([sed '/a,Pearson/,$s/,\([[^,]]*\),.*/,\1,.../' pspp.csv], [0], [dnl
192 Table: Descriptive Statistics
193 ,Mean,Std. Deviation,N
206 a,Pearson Correlation,...
209 f,Pearson Correlation,...
212 b,Pearson Correlation,...
220 dnl Checks for bug #40661
221 AT_SETUP([CORRELATIONS -- incorrect subtable selection])
222 AT_DATA([correlations.sps], [dnl
225 data list notable list /var1 var2 var3 var4 var5 *.
330 /VARIABLES = var1 var2 var3 WITH var4 var5
331 /PRINT = TWOTAIL NOSIG.
334 /VARIABLES = var3 var4 var5 WITH var1 var2
335 /PRINT = TWOTAIL NOSIG.
339 AT_CHECK([pspp -O format=csv correlations.sps], [0],
342 var1,Pearson Correlation,.5693,-.0519
343 ,Sig. (2-tailed),.000,.623
345 var2,Pearson Correlation,.3792,-.0407
346 ,Sig. (2-tailed),.000,.698
348 var3,Pearson Correlation,.3699,-.0543
349 ,Sig. (2-tailed),.000,.603
354 var3,Pearson Correlation,.6964,.5615
355 ,Sig. (2-tailed),.000,.000
357 var4,Pearson Correlation,.5693,.3792
358 ,Sig. (2-tailed),.000,.000
360 var5,Pearson Correlation,-.0519,-.0407
361 ,Sig. (2-tailed),.623,.698
368 dnl Crash found by zzuf
369 AT_SETUP([CORRELATIONS -- empty dataset])
371 AT_DATA([correlations.sps], [dnl
372 data list list /a b c q g *.
373 CORRELATIONS 'VARIABLES = a b.]
376 AT_CHECK([pspp -o pspp.csv correlations.sps], [1], [ignore])
380 dnl Another Crash found by zzuf
381 AT_SETUP([CORRELATIONS -- empty dataset 2])
383 AT_DATA([correlations.sps], [dnl
384 data list notable list /foo * bar * wiz bang *.
394 variables = foo bar wiz bang
399 AT_CHECK([pspp -O format=csv correlations.sps], [1], [dnl
400 correlations.sps:13: error: CORRELATIONS: The data for the chosen variables are all missing or empty.