1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017, 2020 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/>.
17 AT_BANNER([MATRIX DATA])
19 dnl Keep this test in sync with Example 1 in doc/matrices.texi.
20 AT_SETUP([MATRIX DATA - LOWER DIAGONAL with ROWTYPE_])
21 AT_DATA([matrix-data.sps], [dnl
23 VARIABLES=ROWTYPE_ var01 TO var08
24 /FILE='matrix-data.txt'.
25 FORMATS var01 TO var08(F5.2).
28 AT_DATA([matrix-data.txt], [dnl
29 MEAN 24.3 5.4 69.7 20.1 13.4 2.7 27.9 3.7
30 SD 5.7 1.5 23.5 5.8 2.8 4.5 5.4 1.5
31 N 92 92 92 92 92 92 92 92
35 "CORR" .36 .31 -.14 1.00
36 COR .27 .16 -.12 .22 1.00
37 CORR .33 .15 -.17 .24 .21 1.00
38 CORR .50 .29 -.20 .32 .12 .38 1.00
39 CORR .17 .29 -.05 .20 .27 .20 .04 1.00
42 AT_CHECK([pspp -O format=csv matrix-data.sps], [0], [dnl
44 ROWTYPE_,VARNAME_,var01,var02,var03,var04,var05,var06,var07,var08
45 MEAN,,24.30,5.40,69.70,20.10,13.40,2.70,27.90,3.70
46 STDDEV,,5.70,1.50,23.50,5.80,2.80,4.50,5.40,1.50
47 N,,92.00,92.00,92.00,92.00,92.00,92.00,92.00,92.00
48 CORR,var01,1.00,.18,-.22,.36,.27,.33,.50,.17
49 CORR,var02,.18,1.00,-.17,.31,.16,.15,.29,.29
50 CORR,var03,-.22,-.17,1.00,-.14,-.12,-.17,-.20,-.05
51 CORR,var04,.36,.31,-.14,1.00,.22,.24,.32,.20
52 CORR,var05,.27,.16,-.12,.22,1.00,.21,.12,.27
53 CORR,var06,.33,.15,-.17,.24,.21,1.00,.38,.20
54 CORR,var07,.50,.29,-.20,.32,.12,.38,1.00,.04
55 CORR,var08,.17,.29,-.05,.20,.27,.20,.04,1.00
59 AT_SETUP([MATRIX DATA - UPPER DIAGONAL with ROWTYPE_])
60 AT_DATA([matrix-data.sps], [dnl
62 variables = rowtype_ var01 var02 var03 var04
63 /format = upper diagonal.
78 AT_CHECK([pspp -O format=csv matrix-data.sps], [0], [dnl
80 ROWTYPE_,VARNAME_,var01,var02,var03,var04
81 MEAN,,34.0000,35.0000,36.0000,37.0000
82 STDDEV,,22.0000,11.0000,55.0000,66.0000
83 N,,100.0000,101.0000,102.0000,103.0000
84 CORR,var01,1.0000,9.0000,8.0000,7.0000
85 CORR,var02,9.0000,1.0000,6.0000,5.0000
86 CORR,var03,8.0000,6.0000,1.0000,4.0000
87 CORR,var04,7.0000,5.0000,4.0000,1.0000
91 AT_SETUP([MATRIX DATA - FULL with ROWTYPE_])
92 dnl Just for fun, this one is in a different case.
93 AT_DATA([matrix-data.sps], [dnl
95 variables = ROWTYPE_ var01 var02 var03 var04
96 /format = full diagonal.
111 AT_CHECK([pspp -O format=csv matrix-data.sps], [0], [dnl
113 ROWTYPE_,VARNAME_,var01,var02,var03,var04
114 MEAN,,34.0000,35.0000,36.0000,37.0000
115 STDDEV,,22.0000,11.0000,55.0000,66.0000
116 N,,100.0000,101.0000,102.0000,103.0000
117 CORR,var01,1.0000,9.0000,8.0000,7.0000
118 CORR,var02,9.0000,1.0000,6.0000,5.0000
119 CORR,var03,8.0000,6.0000,1.0000,4.0000
120 CORR,var04,7.0000,5.0000,4.0000,1.0000
125 AT_SETUP([MATRIX DATA - UPPER NODIAGONAL with ROWTYPE_])
126 AT_DATA([matrix-data.sps], [dnl
128 variables = rowtype_ var01 var02 var03 var04
129 /format = upper nodiagonal.
143 AT_CHECK([pspp -O format=csv matrix-data.sps], [0], [dnl
145 ROWTYPE_,VARNAME_,var01,var02,var03,var04
146 MEAN,,34.0000,35.0000,36.0000,37.0000
147 STDDEV,,22.0000,11.0000,55.0000,66.0000
148 N,,100.0000,101.0000,102.0000,103.0000
149 CORR,var01,1.0000,9.0000,8.0000,7.0000
150 CORR,var02,9.0000,1.0000,6.0000,5.0000
151 CORR,var03,8.0000,6.0000,1.0000,4.0000
152 CORR,var04,7.0000,5.0000,4.0000,1.0000
156 dnl Keep this test in sync with Example 2 in doc/matrices.texi.
157 AT_SETUP([MATRIX DATA - UPPER NODIAGONAL with ROWTYPE_ - 2])
158 AT_DATA([matrix-data.sps], [dnl
160 VARIABLES=ROWTYPE_ var01 TO var08
161 /FORMAT=UPPER NODIAGONAL.
163 MEAN 24.3 5.4 69.7 20.1 13.4 2.7 27.9 3.7
164 SD 5.7 1.5 23.5 5.8 2.8 4.5 5.4 1.5
165 N 92 92 92 92 92 92 92 92
166 CORR .17 .50 -.33 .27 .36 -.22 .18
167 CORR .29 .29 -.20 .32 .12 .38
168 CORR .05 .20 -.15 .16 .21
169 CORR .20 .32 -.17 .12
174 FORMATS var01 TO var08(F6.2).
177 AT_CHECK([pspp -O format=csv matrix-data.sps], [0], [dnl
179 ROWTYPE_,VARNAME_,var01,var02,var03,var04,var05,var06,var07,var08
180 MEAN,,24.30,5.40,69.70,20.10,13.40,2.70,27.90,3.70
181 STDDEV,,5.70,1.50,23.50,5.80,2.80,4.50,5.40,1.50
182 N,,92.00,92.00,92.00,92.00,92.00,92.00,92.00,92.00
183 CORR,var01,1.00,.17,.50,-.33,.27,.36,-.22,.18
184 CORR,var02,.17,1.00,.29,.29,-.20,.32,.12,.38
185 CORR,var03,.50,.29,1.00,.05,.20,-.15,.16,.21
186 CORR,var04,-.33,.29,.05,1.00,.20,.32,-.17,.12
187 CORR,var05,.27,-.20,.20,.20,1.00,.27,.12,-.24
188 CORR,var06,.36,.32,-.15,.32,.27,1.00,-.20,-.38
189 CORR,var07,-.22,.12,.16,-.17,.12,-.20,1.00,.04
190 CORR,var08,.18,.38,.21,.12,-.24,-.38,.04,1.00
194 AT_SETUP([MATRIX DATA - LOWER NODIAGONAL with ROWTYPE_])
195 AT_DATA([matrix-data.sps], [dnl
197 variables = rowtype_ var01 var02 var03 var04
198 /format = lower nodiagonal
213 AT_CHECK([pspp -O format=csv matrix-data.sps], [0], [dnl
214 matrix-data.sps:4: warning: MATRIX DATA: CELLS is ignored when VARIABLES includes ROWTYPE_
217 ROWTYPE_,VARNAME_,var01,var02,var03,var04
218 MEAN,,34.0000,35.0000,36.0000,37.0000
219 STDDEV,,22.0000,11.0000,55.0000,66.0000
220 N,,100.0000,101.0000,102.0000,103.0000
221 CORR,var01,1.0000,9.0000,8.0000,7.0000
222 CORR,var02,9.0000,1.0000,6.0000,5.0000
223 CORR,var03,8.0000,6.0000,1.0000,4.0000
224 CORR,var04,7.0000,5.0000,4.0000,1.0000
228 AT_SETUP([MATRIX DATA - split data])
229 AT_DATA([matrix-data.sps], [dnl
231 variables = s1 s2 rowtype_ var01 var02 var03
235 8 0 mean 21.4 5.0 72.9
241 8 1 mean 11.4 1.0 52.9
254 AT_CHECK([pspp -O format=csv matrix-data.sps], [0], [dnl
256 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
257 s1,1,Scale,Input,8,Right,F4.0,F4.0
258 s2,2,Scale,Input,8,Right,F4.0,F4.0
259 ROWTYPE_,3,Nominal,Input,8,Left,A8,A8
260 VARNAME_,4,Nominal,Input,8,Left,A8,A8
261 var01,5,Scale,Input,8,Right,F10.4,F10.4
262 var02,6,Scale,Input,8,Right,F10.4,F10.4
263 var03,7,Scale,Input,8,Right,F10.4,F10.4
271 s1,s2,ROWTYPE_,VARNAME_,var01,var02,var03
272 8,0,MEAN,,21.4000,5.0000,72.9000
273 8,0,STDDEV,,6.5000,1.6000,22.8000
274 8,0,N,,106.0000,106.0000,106.0000
275 8,0,CORR,var01,1.0000,.4100,-.1600
276 8,0,CORR,var02,.4100,1.0000,-.2200
277 8,0,CORR,var03,-.1600,-.2200,1.0000
285 s1,s2,ROWTYPE_,VARNAME_,var01,var02,var03
286 8,1,MEAN,,11.4000,1.0000,52.9000
287 8,1,STDDEV,,9.5000,8.6000,12.8000
288 8,1,N,,10.0000,11.0000,12.0000
289 8,1,CORR,var01,1.0000,.5100,.3600
290 8,1,CORR,var02,.5100,1.0000,-.4100
291 8,1,CORR,var03,.3600,-.4100,1.0000
296 dnl Keep this test in sync with Example 4 in doc/matrices.texi.
297 AT_SETUP([MATRIX DATA - split data - 2])
298 AT_DATA([matrix-data.sps], [dnl
300 VARIABLES=s1 ROWTYPE_ var01 TO var04
319 FORMATS var01 TO var04(F5.1).
323 AT_CHECK([pspp -O format=csv matrix-data.sps], [0], [dnl
329 s1,ROWTYPE_,VARNAME_,var01,var02,var03,var04
330 0,MEAN,,34.0,35.0,36.0,37.0
331 0,STDDEV,,22.0,11.0,55.0,66.0
332 0,N,,99.0,98.0,99.0,92.0
333 0,CORR,var01,1.0,.9,.8,.7
334 0,CORR,var02,.9,1.0,.6,.5
335 0,CORR,var03,.8,.6,1.0,.4
336 0,CORR,var04,.7,.5,.4,1.0
343 s1,ROWTYPE_,VARNAME_,var01,var02,var03,var04
344 1,MEAN,,44.0,45.0,34.0,39.0
345 1,STDDEV,,23.0,15.0,51.0,46.0
346 1,N,,98.0,34.0,87.0,23.0
347 1,CORR,var01,1.0,.2,.3,.4
348 1,CORR,var02,.2,1.0,.5,.6
349 1,CORR,var03,.3,.5,1.0,.7
350 1,CORR,var04,.4,.6,.7,1.0
354 dnl Keep this test in sync with Example 5 in doc/matrices.texi.
355 AT_SETUP([MATRIX DATA - factor variables])
356 AT_DATA([matrix-data.sps], [dnl
358 VARIABLES=ROWTYPE_ f1 var01 TO var04
372 FORMATS var01 TO var04(F5.1).
376 AT_CHECK([pspp -O format=csv matrix-data.sps], [0], [dnl
378 ROWTYPE_,f1,VARNAME_,var01,var02,var03,var04
379 MEAN,0,,34.0,35.0,36.0,37.0
380 STDDEV,0,,22.0,11.0,55.0,66.0
381 N,0,,99.0,98.0,99.0,92.0
382 MEAN,1,,44.0,45.0,34.0,39.0
383 STDDEV,1,,23.0,15.0,51.0,46.0
384 N,1,,98.0,34.0,87.0,23.0
385 CORR,.,var01,1.0,.9,.8,.7
386 CORR,.,var02,.9,1.0,.6,.5
387 CORR,.,var03,.8,.6,1.0,.4
388 CORR,.,var04,.7,.5,.4,1.0
392 AT_SETUP([MATRIX DATA - factors and splits])
393 AT_DATA([matrix-data.sps], [dnl
395 variables = s f rowtype_ var01 var02 var03
400 8 0 mean 21.4 5.0 72.9
406 9 1 mean 11.4 1.0 52.9
418 AT_CHECK([pspp matrix-data.sps -O format=csv], [0], [dnl
420 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
421 s,1,Scale,Input,8,Right,F4.0,F4.0
422 ROWTYPE_,2,Nominal,Input,8,Left,A8,A8
423 f,3,Scale,Input,8,Right,F4.0,F4.0
424 VARNAME_,4,Nominal,Input,8,Left,A8,A8
425 var01,5,Scale,Input,8,Right,F10.4,F10.4
426 var02,6,Scale,Input,8,Right,F10.4,F10.4
427 var03,7,Scale,Input,8,Right,F10.4,F10.4
434 s,ROWTYPE_,f,VARNAME_,var01,var02,var03
435 8,MEAN,0,,21.4000,5.0000,72.9000
436 8,STDDEV,0,,6.5000,1.6000,22.8000
437 8,N,0,,106.0000,106.0000,106.0000
438 8,CORR,.,var01,1.0000,.4100,-.1600
439 8,CORR,.,var02,.4100,1.0000,-.2200
440 8,CORR,.,var03,-.1600,-.2200,1.0000
447 s,ROWTYPE_,f,VARNAME_,var01,var02,var03
448 9,MEAN,1,,11.4000,1.0000,52.9000
449 9,STDDEV,1,,9.5000,8.6000,12.8000
450 9,N,1,,10.0000,11.0000,12.0000
451 9,CORR,.,var01,1.0000,.5100,.3600
452 9,CORR,.,var02,.5100,1.0000,-.4100
453 9,CORR,.,var03,.3600,-.4100,1.0000
457 AT_SETUP([MATRIX DATA - bad ROWTYPE_])
458 AT_DATA([matrix-data.sps], [dnl
460 variables = rowtype_ var01 var02 var03 var04
461 /format = upper diagonal.
473 AT_CHECK([pspp -O format=csv matrix-data.sps], [1], [dnl
474 "matrix-data.sps:6.1-6.4: error: Unknown row type ""cork""."
478 AT_SETUP([MATRIX DATA - unexpected ROWTYPE_])
479 AT_DATA([matrix-data.sps], [dnl
481 variables = rowtype_ f1 var01 var02 var03 var04
484 /format = upper diagonal.
503 AT_CHECK([pspp -O format=csv matrix-data.sps], [0], [dnl
504 matrix-data.sps:12: warning: Data contains pooled row type STDDEV not included in CONTENTS.
506 matrix-data.sps:14: warning: Data contains with-factors row type CORR not included in CONTENTS.
509 ROWTYPE_,f1,VARNAME_,var01,var02,var03,var04
510 CORR,.,var01,1.0000,9.0000,8.0000,7.0000
511 CORR,.,var02,9.0000,1.0000,6.0000,5.0000
512 CORR,.,var03,8.0000,6.0000,1.0000,4.0000
513 CORR,.,var04,7.0000,5.0000,4.0000,1.0000
514 STDDEV,.,,1.0000,2.0000,3.0000,4.0000
515 CORR,0,var01,1.0000,9.0000,8.0000,7.0000
516 CORR,0,var02,9.0000,1.0000,6.0000,5.0000
517 CORR,0,var03,8.0000,6.0000,1.0000,4.0000
518 CORR,0,var04,7.0000,5.0000,4.0000,1.0000
519 STDDEV,0,,1.0000,2.0000,3.0000,4.0000
523 AT_SETUP([MATRIX DATA - bad number])
524 AT_DATA([matrix-data.sps], [dnl
526 variables = rowtype_ var01 var02 var03 var04
527 /format = upper diagonal.
539 AT_CHECK([pspp -O format=csv matrix-data.sps], [1], [dnl
540 matrix-data.sps:7.15: error: Field contents are not numeric.
543 ROWTYPE_,VARNAME_,var01,var02,var03,var04
544 CORR,var01,1.0000,9.0000,8.0000,7.0000
545 CORR,var02,9.0000,1.0000,. ,5.0000
546 CORR,var03,8.0000,. ,1.0000,4.0000
547 CORR,var04,7.0000,5.0000,4.0000,1.0000
551 AT_SETUP([MATRIX DATA - long variable names])
552 AT_DATA([matrix-data.sps], [dnl
554 variables = rowtype_ var01 var_two variable_number_three variableFour
555 /format = upper diagonal.
560 n_vector 100 101 102 103
570 AT_CHECK([pspp -O format=csv matrix-data.sps], [0], [dnl
572 ROWTYPE_,VARNAME_,var01,var_two,variable_number_three,variableFour
573 MEAN,,34.0000,35.0000,36.0000,37.0000
574 STDDEV,,22.0000,11.0000,55.0000,66.0000
575 N,,100.0000,101.0000,102.0000,103.0000
576 CORR,var01,1.0000,9.0000,8.0000,7.0000
577 CORR,var_two,9.0000,1.0000,6.0000,5.0000
578 CORR,variable_number_three,8.0000,6.0000,1.0000,4.0000
579 CORR,variableFour,7.0000,5.0000,4.0000,1.0000
583 AT_SETUP([MATRIX DATA - read integrity])
584 dnl Check that matrices presented are read correctly.
585 dnl The example below is an unlikely one since all
586 dnl covariance/correlation matrices must be symmetrical
587 dnl but it serves a purpose for this test.
588 AT_DATA([matrix-reader.sps], [dnl
590 variables = rowtype_ var01 to var9
595 sd 100 200 300 400 500 600 700 800 900
596 corr 11 12 13 14 15 16 17 18 19
597 corr 21 22 23 24 25 26 27 28 29
598 corr 31 32 33 34 35 36 37 38 39
599 corr 41 42 43 44 45 46 47 48 49
600 corr 51 52 53 54 55 56 57 58 59
601 corr 61 62 63 64 65 66 67 68 69
602 corr 71 72 73 74 75 76 77 78 79
603 corr 81 82 83 84 85 86 87 88 89
604 corr 91 92 93 94 95 96 97 98 99
607 FORMATS var01 to var09(F3.0).
609 factor /matrix = in (corr = *)
610 /analysis var02 var04 var06
611 /method = correlation
616 AT_CHECK([pspp --testing-mode -O format=csv matrix-reader.sps], [0], [dnl
617 Table: Debug Matrix Reader
618 ,,,var01,var02,var03,var04,var05,var06,var07,var08,var09
619 1,Correlation,var01,11.000,12.000,13.000,14.000,15.000,16.000,17.000,18.000,19.000
620 ,,var02,21.000,22.000,23.000,24.000,25.000,26.000,27.000,28.000,29.000
621 ,,var03,31.000,32.000,33.000,34.000,35.000,36.000,37.000,38.000,39.000
622 ,,var04,41.000,42.000,43.000,44.000,45.000,46.000,47.000,48.000,49.000
623 ,,var05,51.000,52.000,53.000,54.000,55.000,56.000,57.000,58.000,59.000
624 ,,var06,61.000,62.000,63.000,64.000,65.000,66.000,67.000,68.000,69.000
625 ,,var07,71.000,72.000,73.000,74.000,75.000,76.000,77.000,78.000,79.000
626 ,,var08,81.000,82.000,83.000,84.000,85.000,86.000,87.000,88.000,89.000
627 ,,var09,91.000,92.000,93.000,94.000,95.000,96.000,97.000,98.000,99.000
628 ,N,Value,1.000,2.000,3.000,4.000,5.000,6.000,7.000,8.000,9.000
629 ,Standard Deviation,Value,100.000,200.000,300.000,400.000,500.000,600.000,700.000,800.000,900.000
632 ROWTYPE_,VARNAME_,var01,var02,var03,var04,var05,var06,var07,var08,var09
633 N,,1,2,3,4,5,6,7,8,9
634 STDDEV,,100,200,300,400,500,600,700,800,900
635 CORR,var01,11,12,13,14,15,16,17,18,19
636 CORR,var02,21,22,23,24,25,26,27,28,29
637 CORR,var03,31,32,33,34,35,36,37,38,39
638 CORR,var04,41,42,43,44,45,46,47,48,49
639 CORR,var05,51,52,53,54,55,56,57,58,59
640 CORR,var06,61,62,63,64,65,66,67,68,69
641 CORR,var07,71,72,73,74,75,76,77,78,79
642 CORR,var08,81,82,83,84,85,86,87,88,89
643 CORR,var09,91,92,93,94,95,96,97,98,99
645 Table: Correlation Matrix
647 Correlation,var02,22.000,24.000,26.000
648 ,var04,42.000,44.000,46.000
649 ,var06,62.000,64.000,66.000
651 Table: Component Matrix
660 AT_SETUP([MATRIX DATA - too many rows])
661 dnl Test for a crash which occurred when the matrix had more rows declared
662 dnl than variables to hold them.
663 AT_DATA([matrix-data.sps], [dnl
666 var01 var02 var03 var04
667 / format = upper diagonal .
669 mean 21.4 5.0 72.9 17.4
672 corr 1.00 .32 .48 .28
673 corr 1.00 .72 .54 .44
674 corr 1.00 .50 .59 .64
675 corr 1.00 .62 .49 -.30
676 corr 1.00 .56 -.38 .52
677 corr 1.00 -.73 .91 .80
682 FORMATS var01 TO var04 (F6.2).
686 AT_CHECK([pspp -O format=csv matrix-data.sps], [1], [dnl
687 matrix-data.sps:10.29-10.31: error: Extraneous data expecting end of line.
689 matrix-data.sps:11.24-11.31: error: Extraneous data expecting end of line.
691 matrix-data.sps:12.19-12.32: error: Extraneous data expecting end of line.
693 matrix-data.sps:18: error: Matrix CORR had 9 rows but 4 rows were expected.
696 ROWTYPE_,VARNAME_,var01,var02,var03,var04
697 MEAN,,21.40,5.00,72.90,17.40
698 STDDEV,,6.50,1.60,22.80,5.70
699 N,,106.00,106.00,106.00,106.00
700 CORR,var01,1.00,.32,.48,.28
701 CORR,var02,.32,1.00,.72,.54
702 CORR,var03,.48,.72,1.00,.50
703 CORR,var04,.28,.54,.50,1.00
707 AT_SETUP([MATRIX DATA - too few rows])
708 AT_DATA([matrix-data.sps], [dnl
710 variables = rowtype_ s1 var01 var02 var03 var04
712 /format = upper diagonal
713 /file='matrix-data.txt'.
714 FORMATS var01 TO var04 (F6.2).
717 AT_DATA([matrix-data.txt], [dnl
718 mean 1 21.4 5.0 72.9 17.4
719 sd 1 6.5 1.6 22.8 5.7
721 corr 1 1.00 .32 .48 .28
722 corr 2 1.00 .32 .48 .28
726 AT_CHECK([pspp -O format=csv matrix-data.sps], [1], [dnl
727 matrix-data.txt:5: error: Matrix CORR had 1 rows but 4 rows were expected.
729 matrix-data.txt:6: error: Matrix CORR had 2 rows but 4 rows were expected.
736 s1,ROWTYPE_,VARNAME_,var01,var02,var03,var04
737 1,MEAN,,21.40,5.00,72.90,17.40
738 1,STDDEV,,6.50,1.60,22.80,5.70
739 1,N,,106.00,106.00,106.00,106.00
740 1,CORR,var01,1.00,.32,.48,.28
741 1,CORR,var02,.32,1.00,. ,. @&t@
742 1,CORR,var03,.48,. ,1.00,. @&t@
743 1,CORR,var04,.28,. ,. ,1.00
750 s1,ROWTYPE_,VARNAME_,var01,var02,var03,var04
751 2,CORR,var01,1.00,.32,.48,.28
752 2,CORR,var02,.32,2.00,.72,.54
753 2,CORR,var03,.48,.72,1.00,. @&t@
754 2,CORR,var04,.28,.54,. ,1.00
758 AT_SETUP([MATRIX DATA - badly formed])
759 AT_DATA([data.sps], [dnl
760 data list list NOTABLE /ROWTYPE_ (a8) VARNAME_(a4) v1 v2 v3 v4xxxxxxxxxxxxxxxxxxxxxzzzzzzzzzzzzzxxxxxxxxx.
767 corr v3 111 222 333 444
774 AT_CHECK([pspp --testing-mode -O format=csv data.sps], [0], [dnl
775 data.sps:12: warning: DEBUG MATRIX READ: CORR matrix has 4 columns but 3 rows named variables to be analyzed (and 1 rows named unknown variables).
777 Table: Debug Matrix Reader
778 ,,,v1,v2,v3,v4xxxxxxxxxxxxxxxxxxxxxzzzzzzzzzzzzzxxxxxxxxx
779 1,Correlation,v1,11.000,22.000,33.000,44.000
780 ,,v2,55.000,66.000,77.000,88.000
781 ,,v3,111.000,222.000,333.000,444.000
782 ,,v4xxxxxxxxxxxxxxxxxxxxxzzzzzzzzzzzzzxxxxxxxxx,. ,. ,. ,. @&t@
783 ,N,Value,2.000,3.000,4.000,5.000
784 ,Mean,Value,1.000,2.000,3.000,4.000
788 AT_SETUP([MATRIX DATA - N subcommand])
789 AT_DATA([matrix-data.sps], [dnl
791 variables = rowtype_ var01 var02 var03 var04
793 /format = upper nodiagonal.
806 AT_CHECK([pspp -O format=csv matrix-data.sps], [1], [dnl
807 matrix-data.sps:8: error: N record is not allowed with N subcommand. Ignoring N record.
810 ROWTYPE_,VARNAME_,var01,var02,var03,var04
811 N,,99.0000,99.0000,99.0000,99.0000
812 MEAN,,34.0000,35.0000,36.0000,37.0000
813 STDDEV,,22.0000,11.0000,55.0000,66.0000
814 CORR,var01,1.0000,9.0000,8.0000,7.0000
815 CORR,var02,9.0000,1.0000,6.0000,5.0000
816 CORR,var03,8.0000,6.0000,1.0000,4.0000
817 CORR,var04,7.0000,5.0000,4.0000,1.0000
821 dnl Keep this test in sync with Example 3 in doc/matrices.texi.
822 AT_SETUP([MATRIX DATA - N subcommand - 2])
823 AT_DATA([matrix-data.sps], [dnl
825 VARIABLES=ROWTYPE_ var01 TO var08
826 /FORMAT=UPPER NODIAGONAL
829 MEAN 24.3 5.4 69.7 20.1 13.4 2.7 27.9 3.7
830 SD 5.7 1.5 23.5 5.8 2.8 4.5 5.4 1.5
831 CORR .17 .50 -.33 .27 .36 -.22 .18
832 CORR .29 .29 -.20 .32 .12 .38
833 CORR .05 .20 -.15 .16 .21
834 CORR .20 .32 -.17 .12
839 FORMATS var01 TO var08(F6.2).
843 AT_CHECK([pspp -O format=csv matrix-data.sps], [0], [dnl
845 ROWTYPE_,VARNAME_,var01,var02,var03,var04,var05,var06,var07,var08
846 N,,92.00,92.00,92.00,92.00,92.00,92.00,92.00,92.00
847 MEAN,,24.30,5.40,69.70,20.10,13.40,2.70,27.90,3.70
848 STDDEV,,5.70,1.50,23.50,5.80,2.80,4.50,5.40,1.50
849 CORR,var01,1.00,.17,.50,-.33,.27,.36,-.22,.18
850 CORR,var02,.17,1.00,.29,.29,-.20,.32,.12,.38
851 CORR,var03,.50,.29,1.00,.05,.20,-.15,.16,.21
852 CORR,var04,-.33,.29,.05,1.00,.20,.32,-.17,.12
853 CORR,var05,.27,-.20,.20,.20,1.00,.27,.12,-.24
854 CORR,var06,.36,.32,-.15,.32,.27,1.00,-.20,-.38
855 CORR,var07,-.22,.12,.16,-.17,.12,-.20,1.00,.04
856 CORR,var08,.18,.38,.21,.12,-.24,-.38,.04,1.00
860 dnl A "no-crash" test. This was observed to cause problems.
862 AT_SETUP([MATRIX DATA - crash])
864 AT_DATA([matrix-data.sps], [dnl
875 variables = roxtype_ var01
876 /format = upper nodiagonal.
880 AT_CHECK([pspp -O format=csv matrix-data.sps], [1], [ignore])
883 dnl Keep this test in sync with Example 6 in doc/matrices.texi.
884 AT_SETUP([MATRIX DATA - LOWER DIAGONAL without ROWTYPE_])
885 AT_DATA([matrix-data.sps], [dnl
887 VARIABLES=var01 TO var08
888 /CONTENTS=MEAN SD N CORR.
890 24.3 5.4 69.7 20.1 13.4 2.7 27.9 3.7
891 5.7 1.5 23.5 5.8 2.8 4.5 5.4 1.5
892 92 92 92 92 92 92 92 92
897 .27 .16 -.12 .22 1.00
898 .33 .15 -.17 .24 .21 1.00
899 .50 .29 -.20 .32 .12 .38 1.00
900 .17 .29 -.05 .20 .27 .20 .04 1.00
902 FORMATS var01 TO var08(F5.2).
905 AT_CHECK([pspp matrix-data.sps -O format=csv], [0], [dnl
907 ROWTYPE_,VARNAME_,var01,var02,var03,var04,var05,var06,var07,var08
908 MEAN,,24.30,5.40,69.70,20.10,13.40,2.70,27.90,3.70
909 STDDEV,,5.70,1.50,23.50,5.80,2.80,4.50,5.40,1.50
910 N,,92.00,92.00,92.00,92.00,92.00,92.00,92.00,92.00
911 CORR,var01,1.00,.18,-.22,.36,.27,.33,.50,.17
912 CORR,var02,.18,1.00,-.17,.31,.16,.15,.29,.29
913 CORR,var03,-.22,-.17,1.00,-.14,-.12,-.17,-.20,-.05
914 CORR,var04,.36,.31,-.14,1.00,.22,.24,.32,.20
915 CORR,var05,.27,.16,-.12,.22,1.00,.21,.12,.27
916 CORR,var06,.33,.15,-.17,.24,.21,1.00,.38,.20
917 CORR,var07,.50,.29,-.20,.32,.12,.38,1.00,.04
918 CORR,var08,.17,.29,-.05,.20,.27,.20,.04,1.00
922 AT_SETUP([MATRIX DATA - extraneous data without ROWTYPE_])
923 AT_DATA([matrix-data.sps], [dnl
925 VARIABLES=var01 TO var08
926 /CONTENTS=MEAN SD N CORR.
928 24.3 5.4 69.7 20.1 13.4 2.7 27.9 3.7
929 5.7 1.5 23.5 5.8 2.8 4.5 5.4 1.5
930 92 92 92 92 92 92 92 92
935 .27 .16 -.12 .22 1.00
936 .33 .15 -.17 .24 .21 1.00
937 .50 .29 -.20 .32 .12 .38 1.00
938 .17 .29 -.05 .20 .27 .20 .04 1.00
940 FORMATS var01 TO var08(F5.2).
943 AT_CHECK([pspp matrix-data.sps -O format=csv], [1], [dnl
944 matrix-data.sps:8.8-8.10: error: Extraneous data expecting end of line.
947 ROWTYPE_,VARNAME_,var01,var02,var03,var04,var05,var06,var07,var08
948 MEAN,,24.30,5.40,69.70,20.10,13.40,2.70,27.90,3.70
949 STDDEV,,5.70,1.50,23.50,5.80,2.80,4.50,5.40,1.50
950 N,,92.00,92.00,92.00,92.00,92.00,92.00,92.00,92.00
951 CORR,var01,1.00,.18,-.22,.36,.27,.33,.50,.17
952 CORR,var02,.18,1.00,-.17,.31,.16,.15,.29,.29
953 CORR,var03,-.22,-.17,1.00,-.14,-.12,-.17,-.20,-.05
954 CORR,var04,.36,.31,-.14,1.00,.22,.24,.32,.20
955 CORR,var05,.27,.16,-.12,.22,1.00,.21,.12,.27
956 CORR,var06,.33,.15,-.17,.24,.21,1.00,.38,.20
957 CORR,var07,.50,.29,-.20,.32,.12,.38,1.00,.04
958 CORR,var08,.17,.29,-.05,.20,.27,.20,.04,1.00
962 dnl Keep this test in sync with Example 7 in doc/matrices.texi.
963 AT_SETUP([MATRIX DATA - Split variables with explicit values without ROWTYPE_])
964 AT_DATA([matrix-data.sps], [dnl
966 VARIABLES=s1 var01 TO var04
969 /CONTENTS=MEAN SD N CORR.
986 FORMATS var01 TO var04(F5.2).
989 AT_CHECK([pspp matrix-data.sps -O format=csv], [0], [dnl
995 s1,ROWTYPE_,VARNAME_,var01,var02,var03,var04
996 0,MEAN,,34.00,35.00,36.00,37.00
997 0,STDDEV,,22.00,11.00,55.00,66.00
998 0,N,,99.00,98.00,99.00,92.00
999 0,CORR,var01,1.00,.90,.80,.70
1000 0,CORR,var02,.90,1.00,.60,.50
1001 0,CORR,var03,.80,.60,1.00,.40
1002 0,CORR,var04,.70,.50,.40,1.00
1009 s1,ROWTYPE_,VARNAME_,var01,var02,var03,var04
1010 1,MEAN,,44.00,45.00,34.00,39.00
1011 1,STDDEV,,23.00,15.00,51.00,46.00
1012 1,N,,98.00,34.00,87.00,23.00
1013 1,CORR,var01,1.00,.20,.30,.40
1014 1,CORR,var02,.20,1.00,.50,.60
1015 1,CORR,var03,.30,.50,1.00,.70
1016 1,CORR,var04,.40,.60,.70,1.00
1020 dnl Keep this test in sync with Example 8 in doc/matrices.texi.
1021 AT_SETUP([MATRIX DATA - Split variable with sequential values without ROWTYPE_])
1022 AT_DATA([matrix-data.sps], [dnl
1024 VARIABLES=var01 TO var04
1027 /CONTENTS=MEAN SD N CORR.
1044 FORMATS var01 TO var04(F5.2).
1047 AT_CHECK([pspp matrix-data.sps -O format=csv], [0], [dnl
1053 s1,ROWTYPE_,VARNAME_,var01,var02,var03,var04
1054 1,MEAN,,34.00,35.00,36.00,37.00
1055 1,STDDEV,,22.00,11.00,55.00,66.00
1056 1,N,,99.00,98.00,99.00,92.00
1057 1,CORR,var01,1.00,.90,.80,.70
1058 1,CORR,var02,.90,1.00,.60,.50
1059 1,CORR,var03,.80,.60,1.00,.40
1060 1,CORR,var04,.70,.50,.40,1.00
1067 s1,ROWTYPE_,VARNAME_,var01,var02,var03,var04
1068 2,MEAN,,44.00,45.00,34.00,39.00
1069 2,STDDEV,,23.00,15.00,51.00,46.00
1070 2,N,,98.00,34.00,87.00,23.00
1071 2,CORR,var01,1.00,.20,.30,.40
1072 2,CORR,var02,.20,1.00,.50,.60
1073 2,CORR,var03,.30,.50,1.00,.70
1074 2,CORR,var04,.40,.60,.70,1.00
1078 dnl Keep this test in sync with Example 9 in doc/matrices.texi.
1079 AT_SETUP([MATRIX DATA - Factor variables grouping within-cell records by factor without ROWTYPE_])
1080 AT_DATA([matrix-data.sps], [dnl
1082 VARIABLES=f1 var01 TO var04
1085 /CONTENTS=(MEAN SD N) CORR.
1098 FORMATS var01 TO var04(F5.1).
1101 AT_CHECK([pspp matrix-data.sps -O format=csv], [0], [dnl
1103 ROWTYPE_,f1,VARNAME_,var01,var02,var03,var04
1104 MEAN,0,,34.0,35.0,36.0,37.0
1105 STDDEV,0,,22.0,11.0,55.0,66.0
1106 N,0,,99.0,98.0,99.0,92.0
1107 MEAN,1,,44.0,45.0,34.0,39.0
1108 STDDEV,1,,23.0,15.0,51.0,46.0
1109 N,1,,98.0,34.0,87.0,23.0
1110 CORR,.,var01,1.0,.9,.8,.7
1111 CORR,.,var02,.9,1.0,.6,.5
1112 CORR,.,var03,.8,.6,1.0,.4
1113 CORR,.,var04,.7,.5,.4,1.0
1117 dnl Keep this test in sync with Example 10 in doc/matrices.texi.
1118 AT_SETUP([MATRIX DATA - Factor variables grouping within-cell records by row type without ROWTYPE_])
1119 AT_DATA([matrix-data.sps], [dnl
1121 VARIABLES=f1 var01 TO var04
1124 /CONTENTS=(MEAN) (SD) (N) CORR.
1137 FORMATS var01 TO var04(F5.1).
1140 AT_CHECK([pspp matrix-data.sps -O format=csv], [0], [dnl
1142 ROWTYPE_,f1,VARNAME_,var01,var02,var03,var04
1143 MEAN,0,,34.0,35.0,36.0,37.0
1144 MEAN,1,,44.0,45.0,34.0,39.0
1145 STDDEV,0,,22.0,11.0,55.0,66.0
1146 STDDEV,1,,23.0,15.0,51.0,46.0
1147 N,0,,99.0,98.0,99.0,92.0
1148 N,1,,98.0,34.0,87.0,23.0
1149 CORR,.,var01,1.0,.9,.8,.7
1150 CORR,.,var02,.9,1.0,.6,.5
1151 CORR,.,var03,.8,.6,1.0,.4
1152 CORR,.,var04,.7,.5,.4,1.0
1156 AT_SETUP([MATRIX DATA - syntax errors])
1157 AT_DATA([matrix-data.sps], [dnl
1158 MATRIX DATA VARIABLES=var01 varname_.
1159 MATRIX DATA VARIABLES=v v v.
1160 MATRIX DATA VARIABLES=rowtype_ v1 v2 v3/SPLIT=rowtype_.
1161 MATRIX DATA VARIABLES=rowtype_ v1 v2 v3/FACTORS=rowtype_.
1162 MATRIX DATA VARIABLES=rowtype_ s1 v1 v2 v3/SPLIT=v1/FACTORS=v1.
1164 MATRIX DATA VARIABLES=v1 v2 v3/FORMAT=FULL NODIAGONAL.
1165 MATRIX DATA VARIABLES=v1 v2 v3/FACTORS=v1.
1166 MATRIX DATA VARIABLES=v1 v2 v3.
1169 MATRIX DATA VARIABLES=v1/FACTORS=v1.
1170 MATRIX DATA VARIABLES=v1 v2 v3 ROWTYPE_.
1171 MATRIX DATA VARIABLES=v1 v2 v3/CONTENTS=N/N=5.
1172 MATRIX DATA VARIABLES=v1/CONTENTS=XYZZY.
1173 MATRIX DATA VARIABLES=v1/CONTENTS=(.
1174 MATRIX DATA VARIABLES=v1/CONTENTS=(CORR.
1175 MATRIX DATA VARIABLES=v1/CONTENTS=).
1177 MATRIX DATA VARIABLES=v*.
1178 MATRIX DATA VARIABLES=v/N=-1.
1179 MATRIX DATA VARIABLES=v/FORMAT=XYZZY.
1180 MATRIX DATA VARIABLES=v/FILE=123.
1181 MATRIX DATA VARIABLES=v/SPLIT=123.
1182 MATRIX DATA VARIABLES=v/CELLS=-1.
1183 MATRIX DATA VARIABLES=v/XYZZY.
1185 AT_CHECK([pspp matrix-data.sps -O format=csv], [1], [dnl
1186 matrix-data.sps:1: error: MATRIX DATA: VARIABLES may not include VARNAME_.
1188 matrix-data.sps:2: error: MATRIX DATA: Variable v appears twice in variable list.
1190 matrix-data.sps:3: error: MATRIX DATA: ROWTYPE_ is not allowed on SPLIT or FACTORS.
1192 matrix-data.sps:4: error: MATRIX DATA: ROWTYPE_ is not allowed on SPLIT or FACTORS.
1194 matrix-data.sps:5: error: MATRIX DATA: v1 may not appear on both SPLIT and FACTORS.
1196 matrix-data.sps:7: error: MATRIX DATA: FORMAT=FULL and FORMAT=NODIAGONAL are mutually exclusive.
1198 matrix-data.sps:8: error: MATRIX DATA: CELLS is required when factor variables are specified and VARIABLES does not include ROWTYPE_.
1200 matrix-data.sps:9: warning: MATRIX DATA: CONTENTS was not specified and VARIABLES does not include ROWTYPE_. Assuming CONTENTS=CORR.
1202 matrix-data.sps:12: error: MATRIX DATA: CELLS is required when factor variables are specified and VARIABLES does not include ROWTYPE_.
1204 matrix-data.sps:13: error: MATRIX DATA: VARIABLES includes ROWTYPE_ but the continuous variables are not the last ones on VARIABLES.
1206 matrix-data.sps:14: error: MATRIX DATA: Cannot specify N on CONTENTS along with the N subcommand.
1208 matrix-data.sps:15.35-15.39: error: MATRIX DATA: Syntax error at `XYZZY': Row type keyword expected.
1210 matrix-data.sps:16.36: error: MATRIX DATA: Syntax error at end of command: Row type keyword expected.
1212 matrix-data.sps:17.40: error: MATRIX DATA: Syntax error at end of command: Row type keyword expected.
1214 matrix-data.sps:18.35: error: MATRIX DATA: Syntax error at `)': Row type keyword expected.
1216 matrix-data.sps:19.12: error: MATRIX DATA: Syntax error at end of command: expecting VARIABLES.
1218 matrix-data.sps:20.24: error: MATRIX DATA: Syntax error at `*': expecting `/'.
1220 matrix-data.sps:21.27-21.28: error: MATRIX DATA: Syntax error at `-1': Expected non-negative integer for N.
1222 matrix-data.sps:22.32-22.36: error: MATRIX DATA: Syntax error at `XYZZY'.
1224 matrix-data.sps:23.30-23.32: error: MATRIX DATA: Syntax error at `123': expecting a file name or handle name.
1226 matrix-data.sps:24.31-24.33: error: MATRIX DATA: Syntax error at `123': expecting variable name.
1228 matrix-data.sps:25.31-25.32: error: MATRIX DATA: Syntax error at `-1': Expected non-negative integer for CELLS.
1230 matrix-data.sps:26.25-26.29: error: MATRIX DATA: Syntax error at `XYZZY'.
1234 dnl I don't know what lunatic thought this was OK, but we strive to be
1236 AT_SETUP([MATRIX DATA - plus and minus as delimiters])
1237 AT_DATA([matrix-data.sps], [dnl
1239 VARIABLES=ROWTYPE_ var01 TO var08.
1241 MEAN+24.3+5.4+69.7+20.1+13.4+2.7+27.9+3.7
1242 SD +5.7+1.5+23.5+5.8+2.8+4.5+5.4+1.5
1243 N+92+92+92+92+92+92+92+92
1246 CORR-.22e+0-.17+1.00
1247 CORR+.36d-0+.31-.14+1.00
1248 CORR+.27+.16-.12+.22+1.00
1249 CORR+.33+.15-.17+.24+.21+1.00
1250 CORR+.50+.29-.20+.32+.12+.38+1.00
1251 CORR+.17+.29-.05+.20+.27+.20+.04+1.00
1253 FORMATS var01 TO var08(F5.2).
1257 AT_CHECK([pspp -O format=csv matrix-data.sps], [0], [dnl
1259 ROWTYPE_,VARNAME_,var01,var02,var03,var04,var05,var06,var07,var08
1260 MEAN,,24.30,5.40,69.70,20.10,13.40,2.70,27.90,3.70
1261 STDDEV,,5.70,1.50,23.50,5.80,2.80,4.50,5.40,1.50
1262 N,,92.00,92.00,92.00,92.00,92.00,92.00,92.00,92.00
1263 CORR,var01,1.00,.18,-.22,.36,.27,.33,.50,.17
1264 CORR,var02,.18,1.00,-.17,.31,.16,.15,.29,.29
1265 CORR,var03,-.22,-.17,1.00,-.14,-.12,-.17,-.20,-.05
1266 CORR,var04,.36,.31,-.14,1.00,.22,.24,.32,.20
1267 CORR,var05,.27,.16,-.12,.22,1.00,.21,.12,.27
1268 CORR,var06,.33,.15,-.17,.24,.21,1.00,.38,.20
1269 CORR,var07,.50,.29,-.20,.32,.12,.38,1.00,.04
1270 CORR,var08,.17,.29,-.05,.20,.27,.20,.04,1.00