output: Introduce pivot tables.
[pspp] / tests / language / stats / factor.at
index f1d4b2360b6f798c78b9f67ecfba0ec30e8a204b..ab0b066c2b88c16eec804755c0d198bbf737f777 100644 (file)
@@ -1,3 +1,19 @@
+dnl PSPP - a program for statistical analysis.
+dnl Copyright (C) 2017 Free Software Foundation, Inc.
+dnl 
+dnl This program is free software: you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation, either version 3 of the License, or
+dnl (at your option) any later version.
+dnl 
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl 
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
+dnl
 AT_BANNER([FACTOR procedure])
 
 AT_SETUP([FACTOR extraction=paf method=correlation])
@@ -1444,6 +1460,7 @@ missing values
 
 factor
  /variables question13 question14 question15 question16 question17 question18 question19 question20 question21 question22 question23 question24
+ /analysis all
  /print univariate det correlation
  /format blank(.30)
  /plot eigen
@@ -1470,7 +1487,7 @@ question24,3.666,.926,1365
 
 Table: Correlation Matrix
 ,,question13,question14,question15,question16,question17,question18,question19,question20,question21,question22,question23,question24
-Correlations,question13,1.000,.661,.600,.566,.577,.409,.286,.304,.476,.333,.564,.454
+Correlation,question13,1.000,.661,.600,.566,.577,.409,.286,.304,.476,.333,.564,.454
 ,question14,.661,1.000,.635,.500,.552,.433,.320,.315,.449,.333,.565,.443
 ,question15,.600,.635,1.000,.505,.587,.457,.359,.356,.509,.369,.582,.435
 ,question16,.566,.500,.505,1.000,.586,.405,.335,.317,.452,.363,.459,.430
@@ -1482,7 +1499,7 @@ Correlations,question13,1.000,.661,.600,.566,.577,.409,.286,.304,.476,.333,.564,
 ,question22,.333,.333,.369,.363,.450,.536,.484,.383,.507,1.000,.493,.444
 ,question23,.564,.565,.582,.459,.613,.569,.444,.410,.598,.493,1.000,.705
 ,question24,.454,.443,.435,.430,.521,.474,.374,.357,.500,.444,.705,1.000
-Determinant,.002,,,,,,,,,,,,
+Caption: Determinant: 0.00
 
 Table: Factor Matrix
 ,Factor,,
@@ -1731,7 +1748,8 @@ begin data.
 end data.
 
 factor
-  /variables read write math science socst  
+  /variables read write math science socst
+  /analysis read write math science socst
   /extraction pc
   /plot eigen
   /criteria mineigen (.557)
@@ -1749,12 +1767,12 @@ socst,1.000,.900
 
 Table: Total Variance Explained
 ,Initial Eigenvalues,,,Extraction Sums of Squared Loadings,,,Rotation Sums of Squared Loadings,,
-Component,Total,% of Variance,Cumulative %,Total,% of Variance,Cumulative %,Total,% of Variance,Cumulative %
-1,3.381,67.616,67.616,3.381,67.616,67.616,2.113,42.267,42.267
-2,.557,11.148,78.764,.557,11.148,78.764,1.825,36.497,78.764
-3,.407,8.136,86.900,,,,,,
-4,.356,7.123,94.023,,,,,,
-5,.299,5.977,100.000,,,,,,
+,Total,% of Variance,Cumulative %,Total,% of Variance,Cumulative %,Total,% of Variance,Cumulative %
+1,3.381,67.6%,67.6%,3.381,67.6%,67.6%,2.113,42.3%,42.3%
+2,.557,11.1%,78.8%,.557,11.1%,78.8%,1.825,36.5%,78.8%
+3,.407,8.1%,86.9%,,,,,,
+4,.356,7.1%,94.0%,,,,,,
+5,.299,6.0%,100.0%,,,,,,
 
 Table: Component Matrix
 ,Component,
@@ -1775,4 +1793,609 @@ science,.900,.198
 socst,.222,.922
 ])
 
-AT_CLEANUP
\ No newline at end of file
+AT_CLEANUP
+
+
+
+AT_SETUP([FACTOR empty dataset])
+dnl Test that something sane happens when the dataset contains no complete observations
+
+AT_DATA([factor-empty.sps],
+  [data list notable list /x * y * z *.
+begin data.
+3.4        .     92.9
+.        32.09   34.2
+1.00     19.80     .
+2.00       .      3.6
+end data.
+
+factor /variables = ALL.
+])
+
+AT_CHECK([pspp -O format=csv factor-empty.sps], [0], [ignore])
+AT_CLEANUP
+
+
+dnl Fixes a crash reported at
+dnl http://lists.gnu.org/archive/html/bug-gnu-pspp/2012-04/msg00001.html
+AT_SETUP([FACTOR /ROTATION=NOROTATE])
+AT_DATA([factor-norotate.sps], [dnl
+DATA LIST FREE / TRAIT1 TO TRAIT5 (F8.2).
+BEGIN DATA
+1 5 5 1 1
+8 9 7 9 8
+9 8 9 9 8
+9 9 9 9 9
+1 9 1 1 9
+9 7 7 9 9
+9 7 9 9 7
+END DATA
+
+FACTOR /VARIABLES=TRAIT1 TO TRAIT5
+    /ROTATION=NOROTATE /* NOROTATE may have caused the problem. */
+    /EXTRACTION=PC
+    /PRINT=DEFAULT DET UNIVARIATE ROTATION SIG CORRELATION.
+])
+
+AT_CHECK([pspp -O format=csv factor-norotate.sps], [0], [dnl
+Table: Descriptive Statistics
+,Mean,Std. Deviation,Analysis N
+TRAIT1,6.57,3.54,7
+TRAIT2,7.71,1.39,7
+TRAIT3,6.71,2.71,7
+TRAIT4,6.71,3.61,7
+TRAIT5,7.29,2.66,7
+
+Table: Correlation Matrix
+,,TRAIT1,TRAIT2,TRAIT3,TRAIT4,TRAIT5
+Correlation,TRAIT1,1.000,.296,.881,.995,.545
+,TRAIT2,.296,1.000,-.022,.326,.837
+,TRAIT3,.881,-.022,1.000,.867,.130
+,TRAIT4,.995,.326,.867,1.000,.544
+,TRAIT5,.545,.837,.130,.544,1.000
+Sig. (1-tailed),TRAIT1,,.260,.004,.000,.103
+,TRAIT2,.260,,.482,.238,.009
+,TRAIT3,.004,.482,,.006,.390
+,TRAIT4,.000,.238,.006,,.103
+,TRAIT5,.103,.009,.390,.103,
+Caption: Determinant: 0.00
+
+Table: Communalities
+,Initial,Extraction
+TRAIT1,1.00,1.00
+TRAIT2,1.00,1.00
+TRAIT3,1.00,.99
+TRAIT4,1.00,.99
+TRAIT5,1.00,.99
+
+Table: Total Variance Explained
+,Initial Eigenvalues,,,Extraction Sums of Squared Loadings,,
+,Total,% of Variance,Cumulative %,Total,% of Variance,Cumulative %
+1,3.26,65.3%,65.3%,3.26,65.3%,65.3%
+2,1.54,30.8%,96.0%,1.54,30.8%,96.0%
+3,.17,3.4%,99.4%,.17,3.4%,99.4%
+4,.03,.6%,100.0%,.03,.6%,100.0%
+5,.00,.0%,100.0%,,,
+
+Table: Component Matrix
+,Component,,,
+,1,2,3,4
+TRAIT1,.97,.23,-.08,.00
+TRAIT2,.52,-.81,.28,.00
+TRAIT3,.78,.59,.17,.00
+TRAIT4,.97,.21,-.04,.00
+TRAIT5,.70,-.67,-.23,.00
+])
+AT_CLEANUP
+
+
+
+dnl Fixes a bug in the way that the /CRITERIA = ITERATE option was interpreted.
+dnl http://lists.gnu.org/archive/html/bug-gnu-pspp/2013-09/msg00036.html
+AT_SETUP([FACTOR /CRITERIA=ITERATE])
+AT_DATA([factor-iterate.sps], [dnl
+set format = F20.3.
+data list notable list /x y z *.
+begin data.
+1.00    5.00    3.00
+2.00    2.00    2.00
+3.00    1.00    1.00
+4.00    4.00    5.00
+5.00    3.00    9.00
+6.00    6.00    4.00
+7.00    7.00    6.00
+8.00    8.00    8.00
+9.00    9.00    7.00
+end data.
+
+FACTOR
+ /VARIABLES= x y z
+ /CRITERIA = MINEIGEN (1) ITERATE (25)
+ /EXTRACTION =PAF
+ /METHOD = CORRELATION
+ /PRINT = INITIAL EXTRACTION
+ /CRITERIA = ITERATE (0)
+ /ROTATION = NOROTATE.
+])
+
+AT_CHECK([pspp -O format=csv factor-iterate.sps], [0], [dnl
+Table: Communalities
+,Initial,Extraction
+x,.735,.979
+y,.640,.653
+z,.514,.523
+
+Table: Total Variance Explained
+,Initial Eigenvalues,,,Extraction Sums of Squared Loadings,,
+,Total,% of Variance,Cumulative %,Total,% of Variance,Cumulative %
+1,2.404,80.1%,80.1%,2.155,71.8%,71.8%
+2,.425,14.2%,94.3%,,,
+3,.171,5.7%,100.0%,,,
+
+Table: Factor Matrix
+,Factor
+,1
+x,.990
+y,.808
+z,.723
+])
+AT_CLEANUP
+
+
+AT_SETUP([FACTOR promax])
+AT_DATA([factor-promax.sps], [dnl
+set decimal=dot.
+set format=F22.3.
+
+get file='llz.zsav'.
+
+factor 
+       /variables pz pn ps nz nn ns tz tn ts oz on os sz sn ss zz zn zs 
+       /missing listwise 
+       /print initial extraction rotation 
+       /criteria mineigen(1) iterate(25) 
+       /extraction paf 
+       /method correlation
+       /rotation promax (5).
+])
+
+AT_CHECK([ln -s $top_srcdir/tests/language/stats/llz.zsav .], [0], [ignore])
+
+AT_CHECK([pspp -O format=csv factor-promax.sps], [0], [dnl
+Table: Communalities
+,Initial,Extraction
+PZ,.191,.375
+PN,.042,.102
+PS,.458,.623
+NZ,.100,.163
+NN,.065,.079
+NS,.129,.148
+TZ,.181,.344
+TN,.102,.142
+TS,.310,.372
+OZ,.097,.158
+ON,.323,.410
+OS,.469,.617
+SZ,.104,.170
+SN,.154,.267
+SS,.081,.180
+ZZ,.123,.192
+ZN,.208,.412
+ZS,.130,.158
+
+Table: Total Variance Explained
+,Initial Eigenvalues,,,Extraction Sums of Squared Loadings,,,Rotation Sums of Squared Loadings,,
+,Total,% of Variance,Cumulative %,Total,% of Variance,Cumulative %,Total,% of Variance,Cumulative %
+1,2.968,16.5%,16.5%,2.411,13.4%,13.4%,.   ,.  ,.  @&t@
+2,2.026,11.3%,27.7%,1.271,7.1%,20.5%,.   ,.  ,-Infinity
+3,1.622,9.0%,36.8%,.948,5.3%,25.7%,.   ,.  ,-Infinity
+4,1.086,6.0%,42.8%,.283,1.6%,27.3%,.   ,.  ,-Infinity
+5,.996,5.5%,48.3%,,,,,,
+6,.923,5.1%,53.5%,,,,,,
+7,.873,4.9%,58.3%,,,,,,
+8,.856,4.8%,63.1%,,,,,,
+9,.836,4.6%,67.7%,,,,,,
+10,.816,4.5%,72.2%,,,,,,
+11,.785,4.4%,76.6%,,,,,,
+12,.740,4.1%,80.7%,,,,,,
+13,.713,4.0%,84.7%,,,,,,
+14,.653,3.6%,88.3%,,,,,,
+15,.633,3.5%,91.8%,,,,,,
+16,.604,3.4%,95.2%,,,,,,
+17,.484,2.7%,97.9%,,,,,,
+18,.386,2.1%,100.0%,,,,,,
+
+Table: Factor Matrix
+,Factor,,,
+,1,2,3,4
+PZ,-.276,.154,.510,.124
+PN,.096,.129,-.091,.261
+PS,.746,-.085,.234,.063
+NZ,-.111,.323,.206,-.058
+NN,.007,.260,-.083,-.069
+NS,.366,.096,.046,.051
+TZ,-.228,.172,.509,.059
+TN,.131,.345,-.074,.029
+TS,.601,-.005,.098,.030
+OZ,-.145,.166,.322,-.081
+ON,.607,.082,.073,-.173
+OS,.757,-.059,.171,-.104
+SZ,-.142,.307,.226,-.066
+SN,.175,.436,-.183,.115
+SS,.199,.206,-.083,.302
+ZZ,-.074,.411,-.080,-.104
+ZN,.015,.580,-.252,-.114
+ZS,.365,.156,-.004,.015
+
+Table: Pattern Matrix
+,Factor,,,
+,1,2,3,4
+PZ,-.063,-.126,.599,.085
+PN,-.035,.000,-.033,.325
+PS,.762,-.175,.058,.081
+NZ,.027,.230,.327,-.044
+NN,.008,.289,.008,-.026
+NS,.344,.044,.015,.091
+TZ,.004,-.074,.589,.020
+TN,.097,.307,.033,.103
+TS,.585,-.043,-.017,.062
+OZ,.046,.067,.382,-.109
+ON,.654,.151,-.029,-.145
+OS,.803,-.037,-.009,-.092
+SZ,.009,.213,.345,-.060
+SN,.065,.376,-.036,.227
+SS,.054,.042,-.013,.388
+ZZ,-.044,.434,.078,-.046
+ZN,-.025,.646,-.041,-.006
+ZS,.337,.133,-.013,.067
+
+Table: Structure Matrix
+,Factor,,,
+,1,2,3,4
+PZ,-.177,-.058,.598,-.022
+PN,.068,.110,-.049,.317
+PS,.771,-.138,-.136,.240
+NZ,-.060,.236,.339,.019
+NN,.000,.281,.027,.076
+NS,.368,.080,-.068,.207
+TZ,-.127,-.028,.582,-.049
+TN,.122,.345,.023,.235
+TS,.607,-.018,-.160,.221
+OZ,-.074,.055,.384,-.101
+ON,.619,.104,-.160,.102
+OS,.778,-.064,-.190,.132
+SZ,-.086,.215,.361,-.009
+SN,.143,.453,-.044,.380
+SS,.171,.176,-.052,.420
+ZZ,-.073,.422,.120,.085
+ZN,-.013,.641,.008,.214
+ZS,.361,.158,-.088,.213
+
+Table: Factor Correlation Matrix
+Factor,1,2,3,4
+1,1.000,.008,-.232,.294
+2,.008,1.000,.065,.347
+3,-.232,.065,1.000,-.076
+4,.294,.347,-.076,1.000
+])
+
+
+AT_CLEANUP
+
+
+
+
+
+
+AT_SETUP([FACTOR covariance matrix])
+
+AT_DATA([covariance-matrix.sps], [dnl
+set format = F10.3.
+matrix data
+    variables = rowtype_  var01 var02 var03 var04 var05 var06 var07 var08
+    / format = lower diagonal .
+begin data
+mean     24.3  5.4  69.7  20.1  13.4  2.7  27.9  3.7  
+sd        5.7  1.5  23.5  5.8    2.8  4.5   5.4  1.5  
+n        92   92    92   92     92   92    92   92   
+cov   32.490000 
+cov   1.539000 2.250000 
+cov   -29.469000 -5.992500 552.250000 
+cov   11.901600 2.697000 -19.082000 33.640000 
+cov   4.309200 0.672000 -7.896000 3.572800 7.840000 
+cov   8.464500 1.012500 -17.977500 6.264000 2.646000 20.250000 
+cov   15.390000 2.349000 -25.380000 10.022400 1.814400 9.234000 29.160000 
+cov   1.453500 0.652500 -1.762500 1.740000 1.134000 1.350000 0.324000 2.250000 
+end data.
+
+factor matrix in (cov = *)
+    / method = covariance
+    / print = initial covariance
+    / extraction = pc
+    / rotation = norotate.
+])
+
+AT_CHECK([pspp -O format=csv covariance-matrix.sps], [0], [dnl
+Table: Covariance Matrix
+,var01,var02,var03,var04,var05,var06,var07,var08
+var01,32.490,1.539,-29.469,11.902,4.309,8.464,15.390,1.454
+var02,1.539,2.250,-5.992,2.697,.672,1.013,2.349,.653
+var03,-29.469,-5.992,552.250,-19.082,-7.896,-17.977,-25.380,-1.763
+var04,11.902,2.697,-19.082,33.640,3.573,6.264,10.022,1.740
+var05,4.309,.672,-7.896,3.573,7.840,2.646,1.814,1.134
+var06,8.464,1.013,-17.977,6.264,2.646,20.250,9.234,1.350
+var07,15.390,2.349,-25.380,10.022,1.814,9.234,29.160,.324
+var08,1.454,.653,-1.763,1.740,1.134,1.350,.324,2.250
+
+Table: Communalities
+,Initial
+var01,32.490
+var02,2.250
+var03,552.250
+var04,33.640
+var05,7.840
+var06,20.250
+var07,29.160
+var08,2.250
+
+Table: Total Variance Explained
+,Initial Eigenvalues,,
+,Total,% of Variance,Cumulative %
+1,556.895,81.9%,81.9%
+2,57.963,8.5%,90.4%
+3,23.576,3.5%,93.9%
+4,16.446,2.4%,96.3%
+5,14.603,2.1%,98.4%
+6,6.831,1.0%,99.4%
+7,2.375,.3%,99.8%
+8,1.440,.2%,100.0%
+
+Table: Component Matrix
+,Component,,,,,,
+,1,2,3,4,5,6,7
+var01,1.394,4.388,1.513,-2.851,.849,.396,.033
+var02,.269,.460,-.173,.147,-.146,-.213,.872
+var03,-23.489,.725,.058,.003,.022,-.012,.006
+var04,.926,4.007,-4.068,.241,-.253,.218,-.026
+var05,.363,.829,-.172,-.255,.805,-2.492,.058
+var06,.843,2.354,.971,2.425,2.649,.392,.046
+var07,1.205,3.948,1.926,1.515,-2.450,-.317,-.087
+var08,.085,.319,-.157,-.011,.353,-.341,-.816
+])
+
+AT_CLEANUP
+
+
+
+dnl A more realistic example of factor analysis usage.
+AT_SETUP([FACTOR correlation matrix])
+
+AT_DATA([correlation-matrix.sps], [dnl
+set format = F10.3.
+
+matrix data
+    variables = rowtype_
+    cdi_actws_16  cdi_maxzin_16  rdls_passws_16  rdls_actws_16  cdi_actws_20  cdi_maxzin_20  cdi_actws_26  cdi_maxzin_26  rdls_passws_26  rdls_actws_26
+    nepsy_passws_36  morf_verv_36  bnt_actws_36  klankgr_id_36  snelnoe_36  letters_36  ppvt_passws_50  morf_verv_50
+    nepsy_passws_56  bnt_actws_56  klank_gr_weg_56  snelnoe_56  letters_56
+    leesacc_wo_owo_811  leesacc_tekst_811  leesacc_otekst_811  leessne_wo_owo_811  leesvl_tekst_811  leesvl_otekst_811  leessne_wo_811  spel_wo_owo_811
+    / format = upper diagonal .
+begin data
+mean  64.44  1.74  15.30  11.50  269.03  5.37  441.90  8.57  36.59  33.99  11.68  14.74  18.67  6.70  71.57  2.28  70.45  51.82  18.82  34.57  11.68  45.63  12.94  35.08  92.60  79.28  2.78  61.71  29.44  9.46  13.17  
+sd   74.93  1.36  5.51  4.17  159.26  2.76  128.77  3.50  6.20  6.50  3.55  8.37  5.90  3.01  24.81  4.09  24.44  18.55  2.90  6.46  3.01  14.06  7.69  4.36  7.10  17.57  1.27  25.68  11.75  3.36  4.13
+n     150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 
+corr    1.00  .784  .397  .862  .692  .625  .490  .374  .406  .371  .260  .257  .306  .118  -.148  .072  .202  .234  .198  .241  .205  -.054  .246  .166  .143  .155  -.122  .144  -.010  .135  .241
+corr    1.00  .333  .751  .549  .553  .447  .313  .304  .377  .204  .249  .258  .193  -.158  .119  .150  .216  .127  .209  .242  .046  .233  .120  .155  .107  -.126  .147  -.009  .134  .208
+corr    1.00  .469  .433  .381  .442  .307  .462  .391  .378  .293  .369  .191  -.306  .238  .204  .215  .295  .285  .157  .069  .241  .029  .060  .054  -.043  .124  -.069  .054  .136
+corr    1.00  .708  .663  .509  .419  .434  .432  .267  .255  .342  .132  -.192  .142  .228  .203  .248  .260  .200  -.051  .254  .136  .156  .109  -.126  .172  -.004  .157  .268
+corr    1.00  .787  .710  .567  .402  .511  .274  .285  .332  .154  -.096  .247  .253  .235  .245  .257  .261  -.048  .243  .119  .194  .164  -.108  .184  .011  .157  .235
+corr    1.00  .590  .646  .449  .505  .313  .322  .405  .148  -.117  .152  .294  .322  .252  .321  .267  -.055  .255  .118  .178  .137  -.110  .182  .004  .146  .216
+corr    1.00  .548  .343  .619  .296  .260  .456  .149  -.098  .252  .279  .267  .342  .361  .186  -.066  .215  .107  .148  .059  -.114  .156  -.035  .095  .220
+corr    1.00  .406  .509  .397  .236  .416  .037  -.179  .192  .334  .293  .277  .367  .162  -.150  .306  .171  .307  .173  -.128  .255  .075  .224  .315
+corr    1.00  .410  .497  .560  .574  .240  -.301  .204  .508  .351  .457  .428  .242  -.117  .367  .136  .191  .191  -.102  .215  .053  .185  .273
+corr    1.00  .328  .258  .534  .236  -.202  .200  .333  .209  .352  .375  .302  -.119  .272  .062  .203  .042  -.092  .220  .020  .158  .227
+corr    1.00  .439  .488  .323  -.213  .287  .507  .427  .493  .522  .298  -.142  .371  .109  .215  .213  -.048  .228  .009  .133  .267
+corr    1.00  .437  .381  -.158  .153  .403  .430  .383  .379  .150  -.141  .303  .115  .131  .155  -.170  .206  .039  .193  .254
+corr    1.00  .247  -.143  .182  .521  .364  .415  .688  .304  -.185  .327  .188  .211  .202  -.111  .272  .122  .226  .301
+corr    1.00  -.150  .229  .296  .249  .329  .255  .210  -.036  .252  .141  .230  .112  -.195  .309  .135  .250  .195
+corr    1.00  -.132  -.204  -.162  -.284  -.166  -.189  .294  -.339  -.094  -.218  -.144  .153  -.246  -.128  -.192  -.239
+corr    1.00  .151  .132  .166  .195  .387  -.214  .476  .154  .187  .167  -.236  .410  .316  .370  .245
+corr    1.00  .388  .479  .591  .294  -.171  .351  .102  .245  .180  .003  .274  .059  .178  .236
+corr    1.00  .408  .437  .276  -.153  .353  .251  .318  .229  -.111  .263  .042  .203  .349
+corr    1.00  .467  .234  -.249  .382  .199  .313  .197  -.117  .263  .047  .215  .318
+corr    1.00  .368  -.199  .441  .198  .224  .197  -.099  .329  .105  .256  .322
+corr    1.00  -.211  .473  .233  .253  .268  -.198  .397  .229  .309  .277
+corr    1.00  -.310  -.217  -.312  -.203  .227  -.296  -.260  -.276  -.321
+corr    1.00  .368  .350  .311  -.313  .578  .338  .521  .458
+corr    1.00  .415  .580  -.588  .545  .497  .635  .683
+corr    1.00  .570  -.386  .494  .340  .538  .524
+corr    1.00  -.366  .427  .299  .498  .506
+corr    1.00  -.684  -.620  -.746  -.568
+corr    1.00  .759  .900  .555
+corr    1.00  .814  .400
+corr    1.00  .621
+corr    1.00
+end data .
+
+factor  matrix in (cor = *) 
+    / analysis = cdi_actws_16 rdls_actws_16 cdi_actws_20 cdi_actws_26 rdls_actws_26 bnt_actws_36 bnt_actws_56 
+    / format = default
+    / criteria = factors (1)
+    / extraction = pc
+    / rotation = norotate
+    / print = initial extraction .
+
+])
+
+AT_CHECK([pspp -O format=csv correlation-matrix.sps], [0], [dnl
+Table: Communalities
+,Initial,Extraction
+cdi_actws_16,1.000,.614
+rdls_actws_16,1.000,.660
+cdi_actws_20,1.000,.695
+cdi_actws_26,1.000,.650
+rdls_actws_26,1.000,.536
+bnt_actws_36,1.000,.443
+bnt_actws_56,1.000,.316
+
+Table: Total Variance Explained
+,Initial Eigenvalues,,,Extraction Sums of Squared Loadings,,
+,Total,% of Variance,Cumulative %,Total,% of Variance,Cumulative %
+1,3.914,55.9%,55.9%,3.914,55.9%,55.9%
+2,1.320,18.9%,74.8%,,,
+3,.716,10.2%,85.0%,,,
+4,.422,6.0%,91.0%,,,
+5,.278,4.0%,95.0%,,,
+6,.216,3.1%,98.1%,,,
+7,.135,1.9%,100.0%,,,
+
+Table: Component Matrix
+,Component
+,1
+cdi_actws_16,.784
+rdls_actws_16,.812
+cdi_actws_20,.834
+cdi_actws_26,.806
+rdls_actws_26,.732
+bnt_actws_36,.666
+bnt_actws_56,.562
+])
+
+AT_CLEANUP
+
+
+AT_SETUP([FACTOR bad input])
+
+dnl Test for a crash 
+AT_DATA([bad-input.sps], [dnl
+set format = F10.3.
+MATRIX DATA VARIABLES S1 ROWTYPE_ V1 TO V3 /SPLIT=S1.
+BEGIN DATA
+0 MEAN 2 4 3
+0 SD 1 2 3
+0 N 9 9 9
+0 KORR 1
+0 CORV .6 1
+0 CORR .7 .8 1
+1 MEAN 9 8 7
+1 SD 5 6 7
+1 N 9 9 9
+1 CORR 1
+X CORR .4 1
+1 CORR .3 .2 1
+END DATA.
+
+EXECUTE.
+
+FACTOR MATRIX IN (CORR =!*)
+       /PRINT = CORRELATION
+       .
+])
+
+AT_CHECK([pspp -O format=csv bad-input.sps], [1], [ignore])
+
+AT_CLEANUP
+
+
+AT_SETUP([FACTOR anti-image matrix])
+
+AT_DATA([anti-image-matrix.sps], [dnl
+SET FORMAT=F20.3 .
+matrix data
+ variables = rowtype_ viq piq pa ran piatwr  piatc
+ / n = 476
+ / format = lower diagonal .
+begin data
+mean  96.88  100.51  -1.73  -0.94  -2.52 -1.85
+sd    10.97   11.19   1.19   0.88   0.85  0.97
+corr    1.00
+corr    0.38  1.00
+corr    0.26  0.24  1.00
+corr    0.16  0.17  0.34  1.00
+corr    0.25  0.07  0.46  0.38  1.00
+corr    0.37  0.22  0.39  0.30  0.59   1.00
+end data.
+
+factor matrix = in (cor = *) 
+ / analysis = viq piq pa ran piatwr piatc
+ / format = sort 
+ / extraction = pc
+ / rotation = norotate
+ / print = aic
+])
+
+AT_CHECK([pspp -O format=csv anti-image-matrix.sps], [0], [dnl
+Table: Anti-Image Matrices
+,,viq,piq,pa,ran,piatwr,piatc
+Anti-image Covariance,viq,.762,-.248,-.048,.008,-.031,-.143
+,piq,-.248,.807,-.117,-.081,.108,-.071
+,pa,-.048,-.117,.711,-.125,-.173,-.060
+,ran,.008,-.081,-.125,.808,-.143,-.035
+,piatwr,-.031,.108,-.173,-.143,.551,-.265
+,piatc,-.143,-.071,-.060,-.035,-.265,.581
+Anti-image Correlation,viq,.741,-.316,-.066,.011,-.048,-.215
+,piq,-.316,.624,-.154,-.100,.163,-.103
+,pa,-.066,-.154,.811,-.165,-.277,-.093
+,ran,.011,-.100,-.165,.825,-.214,-.051
+,piatwr,-.048,.163,-.277,-.214,.675,-.469
+,piatc,-.215,-.103,-.093,-.051,-.469,.729
+
+Table: Component Matrix
+,Component,,,,
+,1,2,3,4,5
+piatc,.774,.122,-.368,.365,-.322
+piatwr,.754,.418,.442,.219,-.115
+pa,.707,.124,-.117,-.161,.256
+piq,.456,-.733,.122,-.289,-.377
+viq,.589,-.539,.033,.298,.457
+ran,.592,.262,-.069,-.638,.096
+])
+
+AT_CLEANUP
+
+
+AT_SETUP([FACTOR Kaiser-Meyer-Olkin])
+
+AT_DATA([kmo.sps], [dnl
+SET FORMAT=F20.3 .
+matrix data
+ variables = rowtype_ viq piq pa ran piatwr  piatc
+ / n = 476
+ / format = lower diagonal .
+begin data
+mean  96.88  100.51  -1.73  -0.94  -2.52 -1.85
+sd    10.97   11.19   1.19   0.88   0.85  0.97
+corr    1.00
+corr    0.38  1.00
+corr    0.26  0.24  1.00
+corr    0.16  0.17  0.34  1.00
+corr    0.25  0.07  0.46  0.38  1.00
+corr    0.37  0.22  0.39  0.30  0.59   1.00
+end data.
+
+factor matrix = in (cor = *) 
+ / analysis = viq piq pa ran piatwr piatc
+ / extraction = pc
+ / rotation = norotate
+ / print = kmo
+])
+
+AT_CHECK([pspp -O format=csv kmo.sps], [0], [dnl
+Table: KMO and Bartlett's Test
+Kaiser-Meyer-Olkin Measure of Sampling Adequacy,,.730
+Bartlett's Test of Sphericity,Approx. Chi-Square,602.673
+,df,15
+,Sig.,.000
+
+Table: Component Matrix
+,Component,,,,
+,1,2,3,4,5
+viq,.589,-.539,.033,.298,.457
+piq,.456,-.733,.122,-.289,-.377
+pa,.707,.124,-.117,-.161,.256
+ran,.592,.262,-.069,-.638,.096
+piatwr,.754,.418,.442,.219,-.115
+piatc,.774,.122,-.368,.365,-.322
+])
+
+AT_CLEANUP