1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
|
AT_BANNER([CORRELATIONS])
AT_SETUP([CORRELATIONS -- unweighted])
AT_DATA([correlations.sps], [dnl
set format = F11.3.
data list notable list /foo * bar * wiz * bang *.
begin data.
1 0 3 1
3 9 -50 5
3 4 3 203
4 -9 0 -4
98 78 104 2
3 50 -49 200
. 4 4 4
5 3 0 .
end data.
correlations
variables = foo bar wiz bang
/print nosig
/missing = listwise
.
correlations
variables = bar wiz
/print nosig
/missing = listwise
.
correlations
variables = foo bar wiz bang
/print nosig
/missing = pairwise
.
])
AT_CHECK([pspp -o pspp.csv correlations.sps])
AT_CHECK([cat pspp.csv], [0], [dnl
Table: Correlations
,,foo,bar,wiz,bang
foo,Pearson Correlation,1.000,.802,.890,-.308
,Sig. (2-tailed),,.055,.017,.553
bar,Pearson Correlation,.802,1.000,.519,.118
,Sig. (2-tailed),.055,,.291,.824
wiz,Pearson Correlation,.890,.519,1.000,-.344
,Sig. (2-tailed),.017,.291,,.505
bang,Pearson Correlation,-.308,.118,-.344,1.000
,Sig. (2-tailed),.553,.824,.505,
Table: Correlations
,,bar,wiz
bar,Pearson Correlation,1.000,.497
,Sig. (2-tailed),,.210
wiz,Pearson Correlation,.497,1.000
,Sig. (2-tailed),.210,
Table: Correlations
,,foo,bar,wiz,bang
foo,Pearson Correlation,1.000,.805,.883,-.308
,Sig. (2-tailed),,.029,.008,.553
,N,7,7,7,6
bar,Pearson Correlation,.805,1.000,.497,.164
,Sig. (2-tailed),.029,,.210,.725
,N,7,8,8,7
wiz,Pearson Correlation,.883,.497,1.000,-.337
,Sig. (2-tailed),.008,.210,,.460
,N,7,8,8,7
bang,Pearson Correlation,-.308,.164,-.337,1.000
,Sig. (2-tailed),.553,.725,.460,
,N,6,7,7,7
])
AT_CLEANUP
AT_SETUP([CORRELATIONS -- weighted])
AT_DATA([correlations1.sps], [dnl
set format = F11.3.
data list notable list /foo * bar * wiz * bang * w *.
begin data.
1 0 3 1 1
3 9 -50 5 2
3 4 3 203 1
4 -9 0 -4 1
98 78 104 2 3
3 50 -49 200 1
end data.
weight by w.
correlations
variables = foo bar wiz bang
/statistics=descriptives xprod
.
])
AT_DATA([correlations2.sps], [dnl
set format = F11.3.
data list notable list /foo * bar * wiz * bang * w *.
begin data.
1 0 3 1 1
3 9 -50 5 1
3 9 -50 5 1
3 4 3 203 1
4 -9 0 -4 1
98 78 104 2 1
98 78 104 2 1
98 78 104 2 1
3 50 -49 200 1
end data.
weight by w.
correlations
variables = foo bar wiz bang
/statistics=descriptives xprod
.
])
AT_CHECK([pspp -O format=csv correlations1.sps], [0], [stdout])
mv stdout expout
AT_CHECK([pspp -O format=csv correlations2.sps], [0], [expout])
AT_CLEANUP
AT_SETUP([CORRELATIONS -- non-square])
AT_DATA([corr-ns.sps], [dnl
set format = F11.3.
data list notable list /foo * bar * wiz *.
begin data.
1 1 6
2 2 5
3 3 4
4 4 3
5 5 2
6 6 1
end data.
correlations
variables = foo with bar wiz
.
])
AT_CHECK([pspp -O format=csv corr-ns.sps], [0], [dnl
Table: Correlations
,,bar,wiz
foo,Pearson Correlation,1.000,-1.000
,Sig. (2-tailed),.000,.000
,N,6,6
])
AT_CLEANUP
dnl Checks for bug #38661.
AT_SETUP([CORRELATIONS -- crash with WITH keyword])
AT_DATA([correlations.sps], [dnl
DATA LIST LIST NOTABLE /a b c d e f g h i.
.
BEGIN DATA.
20 21 17 28 23 4.35 24 19 25
28 18 29 30 23 4.55 17 23 28
47 18 30 30 29 4.35 26 31 31
20 7 19 22 22 4.80 24 16 27
19 12 17 27 22 . 22 14 25
22 9 19 30 33 5 29 30 27
41 16 22 32 23 3.90 26 27 23
18 18 20 26 22 5.80 17 20 39
18 24 25 25 31 5.15 27 27 34
19 22 26 23 37 6 41 32 27
23 12 15 29 25 4.10 21 27 20
21 4 28 37 31 5.65 27 18 42
19 5 17 17 29 3.10 19 16 19
21 17 20 35 31 . 28 30 22
END DATA.
CORRELATIONS VARIABLE=a f b WITH c g h i e d/STATISTICS=DESCRIPTIVES.
])
AT_CHECK([pspp -o pspp.csv correlations.sps])
# Check the output, ignoring the actual correlations values since
# they look pretty nonsensical to me for this input (they include NaNs).
AT_CHECK([sed '/a,Pearson/,$s/,\([[^,]]*\),.*/,\1,.../' pspp.csv], [0], [dnl
Table: Descriptive Statistics
,Mean,Std. Deviation,N
a,24.00,8.93,14.00
f,4.73,.85,12.00
b,14.50,6.41,14.00
c,21.71,4.98,14.00
g,24.86,6.09,14.00
h,23.57,6.30,14.00
i,27.79,6.73,14.00
e,27.21,4.95,14.00
d,27.93,5.23,14.00
Table: Correlations
,,c,g,h,i,e,d
a,Pearson Correlation,...
,Sig. (2-tailed),...
,N,...
f,Pearson Correlation,...
,Sig. (2-tailed),...
,N,...
b,Pearson Correlation,...
,Sig. (2-tailed),...
,N,...
])
AT_CLEANUP
dnl Checks for bug #40661
AT_SETUP([CORRELATIONS -- incorrect subtable selection])
AT_DATA([correlations.sps], [dnl
set format = F12.4.
set decimal = dot.
data list notable list /var1 var2 var3 var4 var5 *.
begin data.
7,6,9,2,3
9,12,8,5,8
8,9,7,8,6
8,8,9,10,8
7,6,4,5,3
7,9,8,2,1
9,8,11,,10
8,7,6,,5
6,7,6,,8
6,,3,,4
6,,7,3,3
5,4,2,7,8
9,8,6,11,10
5,6,2,2,4
8,7,6,8,7
10,13,8,12,10
7,8,7,11,2
8,7,7,9,6
10,11,11,8,1
5,8,6,9,9
8,7,5,5,6
5,7,2,1,8
9,8,8,13,6
5,8,5,6,4
,7,5,4,5
,8,4,4,3
,6,4,9,5
8,11,9,12,3
9,11,8,10,6
10,10,7,8,1
6,6,3,8,9
10,9,7,12,2
6,8,,7,4
6,8,3,2,9
7,8,8,2,9
5,6,5,5,5
9,9,7,7,5
9,10,11,7,8
8,11,9,3,3
5,4,4,0,5
9,9,11,14,2
5,6,2,4,4
8,8,7,4,1
9,9,8,14,
6,8,7,2,
10,9,9,6,
8,8,10,9,
7,8,4,12,
6,6,6,7,1
5,7,7,4,10
9,10,10,13,4
9,11,9,8,7
10,13,12,6,8
8,11,6,8,5
7,8,7,12,2
6,7,4,1,10
5,4,5,6,10
7,8,6,12,10
6,5,3,9,2
7,8,8,7,2
5,4,4,9,8
5,7,6,3,9
10,10,9,13,1
8,10,9,5,4
8,9,8,8,7
7,9,9,6,7
10,9,7,12,6
10,13,12,12,4
7,10,9,7,2
6,8,7,11,6
8,11,5,13,2
7,10,6,12,8
10,10,9,7,9
9,12,6,7,10
6,6,8,2,9
10,9,12,13,10
8,9,8,3,6
8,7,6,4,10
8,7,10,12,2
7,6,8,2,7
8,11,6,9,4
6,6,7,8,2
6,7,3,11,4
5,6,3,0,5
10,10,11,15,6
5,4,7,6,8
5,4,4,1,3
6,9,8,1,6
10,11,10,15,8
7,10,4,11,7
9,12,8,6,3
10,10,11,15,2
10,9,9,15,3
6,6,8,5,1
5,7,7,0,3
9,8,10,6,8
9,8,11,11,4
8,10,7,3,4
7,8,7,3,3
8,9,10,13,8
end data.
CORRELATION
/VARIABLES = var1 var2 var3 WITH var4 var5
/PRINT = TWOTAIL NOSIG.
CORRELATION
/VARIABLES = var3 var4 var5 WITH var1 var2
/PRINT = TWOTAIL NOSIG.
])
AT_CHECK([pspp -O format=csv correlations.sps], [0],
[Table: Correlations
,,var4,var5
var1,Pearson Correlation,.5693,-.0519
,Sig. (2-tailed),.000,.623
,N,93,92
var2,Pearson Correlation,.3792,-.0407
,Sig. (2-tailed),.000,.698
,N,95,93
var3,Pearson Correlation,.3699,-.0543
,Sig. (2-tailed),.000,.603
,N,95,94
Table: Correlations
,,var1,var2
var3,Pearson Correlation,.6964,.5615
,Sig. (2-tailed),.000,.000
,N,96,97
var4,Pearson Correlation,.5693,.3792
,Sig. (2-tailed),.000,.000
,N,93,95
var5,Pearson Correlation,-.0519,-.0407
,Sig. (2-tailed),.623,.698
,N,92,93
])
AT_CLEANUP
|