CORRELATIONS: Fixed bug displaying non-sqaure correlation matrices
[pspp] / tests / language / stats / correlations.at
1 AT_BANNER([CORRELATIONS])
2
3 AT_SETUP([CORRELATIONS -- unweighted])
4 AT_DATA([correlations.sps], [dnl
5 set format = F11.3.
6 data list notable list /foo * bar * wiz * bang *.
7 begin data.
8 1   0   3   1
9 3   9 -50   5
10 3   4   3 203
11 4  -9   0  -4
12 98 78 104   2
13 3  50 -49 200
14 .   4   4   4
15 5   3   0   .
16 end data.
17
18 correlations 
19         variables = foo bar wiz bang
20         /print nosig
21         /missing = listwise
22         .
23
24 correlations 
25         variables = bar wiz
26         /print nosig
27         /missing = listwise
28         .
29
30 correlations 
31         variables = foo bar wiz bang
32         /print nosig
33         /missing = pairwise
34         .
35 ])
36 AT_CHECK([pspp -o pspp.csv correlations.sps])
37 AT_CHECK([cat pspp.csv], [0], [dnl
38 Table: Correlations
39 ,,foo,bar,wiz,bang
40 foo,Pearson Correlation,1.000,.802,.890,-.308
41 ,Sig. (2-tailed),,.055,.017,.553
42 bar,Pearson Correlation,.802,1.000,.519,.118
43 ,Sig. (2-tailed),.055,,.291,.824
44 wiz,Pearson Correlation,.890,.519,1.000,-.344
45 ,Sig. (2-tailed),.017,.291,,.505
46 bang,Pearson Correlation,-.308,.118,-.344,1.000
47 ,Sig. (2-tailed),.553,.824,.505,
48
49 Table: Correlations
50 ,,bar,wiz
51 bar,Pearson Correlation,1.000,.497
52 ,Sig. (2-tailed),,.210
53 wiz,Pearson Correlation,.497,1.000
54 ,Sig. (2-tailed),.210,
55
56 Table: Correlations
57 ,,foo,bar,wiz,bang
58 foo,Pearson Correlation,1.000,.805,.883,-.308
59 ,Sig. (2-tailed),,.029,.008,.553
60 ,N,7,7,7,6
61 bar,Pearson Correlation,.805,1.000,.497,.164
62 ,Sig. (2-tailed),.029,,.210,.725
63 ,N,7,8,8,7
64 wiz,Pearson Correlation,.883,.497,1.000,-.337
65 ,Sig. (2-tailed),.008,.210,,.460
66 ,N,7,8,8,7
67 bang,Pearson Correlation,-.308,.164,-.337,1.000
68 ,Sig. (2-tailed),.553,.725,.460,
69 ,N,6,7,7,7
70 ])
71 AT_CLEANUP
72
73 AT_SETUP([CORRELATIONS -- weighted])
74 AT_DATA([correlations1.sps], [dnl
75 set format = F11.3.
76 data list notable list /foo * bar * wiz * bang * w *.
77 begin data.
78 1   0   3   1  1
79 3   9 -50   5  2
80 3   4   3 203  1
81 4  -9   0  -4  1
82 98 78 104   2  3
83 3  50 -49 200  1
84 end data.
85
86 weight by w.
87
88 correlations 
89         variables = foo bar wiz bang
90         /statistics=descriptives xprod
91         .
92 ])
93 AT_DATA([correlations2.sps], [dnl
94 set format = F11.3.
95 data list notable list /foo * bar * wiz * bang * w *.
96 begin data.
97 1   0   3   1  1
98 3   9 -50   5  1
99 3   9 -50   5  1
100 3   4   3 203  1
101 4  -9   0  -4  1
102 98 78 104   2  1
103 98 78 104   2  1
104 98 78 104   2  1
105 3  50 -49 200  1
106 end data.
107
108 weight by w.
109
110 correlations 
111         variables = foo bar wiz bang
112         /statistics=descriptives xprod
113         .
114 ])
115 AT_CHECK([pspp -O format=csv correlations1.sps], [0], [stdout])
116 mv stdout expout
117 AT_CHECK([pspp -O format=csv correlations2.sps], [0], [expout])
118 AT_CLEANUP
119
120
121 AT_SETUP([CORRELATIONS -- non-square])
122 AT_DATA([corr-ns.sps], [dnl
123 set format = F11.3.
124 data list notable list /foo * bar * wiz *.
125 begin data.
126 1 1 6
127 2 2 5 
128 3 3 4
129 4 4 3
130 5 5 2
131 6 6 1
132 end data.
133
134 correlations 
135         variables = foo with bar wiz
136         .
137 ])
138
139 AT_CHECK([pspp -O format=csv corr-ns.sps], [0], [dnl
140 Table: Correlations
141 ,,bar,wiz
142 foo,Pearson Correlation,1.000,-1.000
143 ,Sig. (2-tailed),,.000
144 ,N,6,6
145 ])
146
147 AT_CLEANUP