C     SSAR2                                                             SR2   1 
C     SMALLEST SPACE ANALYSIS-RECTANGULAR - II, A NONMETRIC METHOD FOR  SR2   2 
C     SOLVING FOR TWO SETS OF POINTS GIVEN THE INTER-SET DISTANCES/SIM- SR2   3 
C     ILARITIES.  USEFUL FOR THE STUDY OF REGRESSION CURVES AND MULTIDI-SR2   4 
C     MENSIONAL UNFOLDING (COOMBS) OF PREFERENCE DATA.  THIS            SR2   5 
C     RESEARCH IN NONMETRIC METHODS IS SUPPORTED IN PART BY A NSF GRANT SR2   6 
C     (GS-929) TO L. GUTTMAN AND J. C. LINGOES.  PROGRAMMED IN FORTRAN  SR2   7 
C     II BY LINGOES 12/15/65.                                           SR2   8 
C                                                                       SR2   9 
C     DECK SET-UP FOR G-L(SSAR-II) -                                    SR2  10 
C                                                                       SR2  11 
C        1.  SYSTEM ID CARD/S.                                          SR2  12 
C        2.  BINARY PROGRAM.                                            SR2  13 
C        3.  TITLE CARD (PUNCH A 1 IN COLUMN 1 AND ANY BCD TITLE IN COL-SR2  14 
C            UMNS 2-72, WHICH WILL BE PRINTED OUT FOR EACH PAGE OF OUT- SR2  15 
C            PUT).                                                      SR2  16 
C        4.  PARAMETER CARD, 9 4-COLUMN FIELDS CONTAINING THE FOLLOWING SR2  17 
C            INFORMATION SERIATUM -                                     SR2  18 
C            A)  NS=THE NUMBER OF ROWS OF RECTANGULAR MATRIX (.LE.39),  SR2  19 
C            B)  NV=THE NUMBER OF COLUMNS OF MATRIX (.LE.39),           SR2  20 
C            C)  MIND=MINIMUM NUMBER OF DIMENSIONS DESIRED.  IF ZERO OR SR2  21 
C                BLANK PROGRAM WILL DETERMINE,                          SR2  22 
C            D)  MAXD=MAXIMUM NUMBER OF DIMENSIONS DESIRED (.LE.  5 OR  SR2  23 
C                THE ROW OR COLUMN ORDER OF SUBMATRIX, WHICHEVER IS     SR2  24 
C                SMALLER),                                              SR2  25 
C            E)  ISIM=ZERO OR BLANK IF DISTANCES/DISSIMILARITIES AND 1  SR2  26 
C                IF SIMILARITIES/PROXIMITIES,                           SR2  27 
C            F)  MU=0 OR BLANK IF BOTH A ROW AND A COLUMN SOLUTION IS   SR2  28 
C                DESIRED AND MU=1 IF ONLY A ROW SOLUTION IS NEEDED,     SR2  29 
C            G)  IFD=1 IF DISTANCE MATRIX IS TO BE PRINTED FOR 2 OR MORESR2  30 
C                DIMENSIONS, OTHERWISE SET TO ZERO OR LEAVE BLANK,      SR2  31 
C            H)  IFC=1 IF COORDINATES ARE TO BE PUNCHED FOR 2 OR MORE   SR2  32 
C                DIMENSIONS, OTHERWISE SET TO ZERO OR LEAVE BLANK,      SR2  33 
C            I)  IFCB=1 IF CITY-BLOCK MODEL IS TO BE USED (N. B. IF THISSR2  34 
C                ALTERNATIVE IS USED MIND MUST BE .G. 0), OTHERWISE SET SR2  35 
C                TO ZERO OR LEAVE BLANK FOR EUCLIDEAN MODEL.            SR2  36 
C        5.  FORMAT CARD (DESCRIBING IN F-NOTATION HOW DATA IS PUNCHED).SR2  37 
C        6.  DATA - EACH SET OF CARDS CONTAINS ALL THE DATA FOR ONE ROW SR2  38 
C            OF SUBMATRIX.  NS SETS WILL BE INPUT.                      SR2  39 
C        7.  REPEAT ITEMS 3-6 FOR ADDITIONAL RUNS.                      SR2  40 
C                                                                       SR2  41 
C     *** REFERENCES - LINGOES, J. C.  AN IBM 7090 PROGRAM FOR GUTTMAN- SR2  42 
C                                  LINGOES SMALLEST SPACE ANALYSIS-RII. SR2  43 
C                                  BEHAV. SCI., 1966,11, 322.           SR2  44 
C                                                                       SR2  45 
C     *** NOTE COMMENT CARDS FOR PROGRAM CHANGES ON OTHER SYSTEMS.      SR2  46 
C                                                                       SR2  47 
      DIMENSION DIST(78,78), EVAL(6084), C(78,78), EVEC(6084), X(78,5), SR2  48 
     1XP1(78,6), IND(78,6), STRESS(100), FMT(18), INDEXI(39,39), INDEXJ(SR2  49 
     239,39), PD(39,39), NOTYR(39,39), NTR(39), PHI(78)                 SR2  50 
      COMMON INDEXI,DIST,EVAL,INDEXJ,X,XP1,PD,NOTYR                     SR2  51 
      EQUIVALENCE (DIST,EVEC), (EVAL,C), (XP1,IND)                      SR2  52 
C                                                                       SR2  53 
C     SUBROUTINES NEEDED=ORDER, EIGEN, PLOT, AND MXOUT                  SR2  54 
C                                                                       SR2  55 
      DEFINE FILE 13(3000,255,L,KT)                                     SR2  56 
C     TAPE ASSIGNMENTS                                                  SR2  57 
      ITAPE=5                                                           SR2  58 
      JTAPE=6                                                           SR2  59 
163   KT=1                                                              SR2  60 
C     INPUT TITLE, PARAMETERS, AND FORMAT                               SR2  61 
      READ (ITAPE,147)                                                  SR2  62 
      READ (ITAPE,148) NS,NV,MIND,MAXD,ISIM,MU,IFD,IFC,IFCB             SR2  63 
      READ (ITAPE,149) (FMT(J),J=1,18)                                  SR2  64 
C     INPUT DATA MATRIX TRANSPOSED                                      SR2  65 
      DO 1 J=1,NS                                                       SR2  66 
1     READ (ITAPE,FMT) (PD(I,J),I=1,NV)                                 SR2  67 
      MU=MU+1                                                           SR2  68 
      GO TO (2,4), MU                                                   SR2  69 
C     SAVE DATA IF COLUMN ANALYSIS DESIRED                              SR2  70 
2     DO 3 I=1,NS                                                       SR2  71 
3     WRITE (13'KT) (PD(J,I),J=1,NV)                                    SR2  72 
      KT=1                                                              SR2  73 
C     INITIALIZE                                                        SR2  74 
4     NSP1=NS+1                                                         SR2  75 
      MD=78                                                             SR2  76 
      ND=6                                                              SR2  77 
      M1=1                                                              SR2  78 
      FNV=NV                                                            SR2  79 
      FNS=NS                                                            SR2  80 
      FNVP1=NV+1                                                        SR2  81 
      NSM1=NS-1                                                         SR2  82 
      NSPNV=NS+NV                                                       SR2  83 
      NSNVM1=NSPNV-1                                                    SR2  84 
      NSNVP1=NSPNV+1                                                    SR2  85 
      FN=NS+NV-1                                                        SR2  86 
      FNR=FN+1.                                                         SR2  87 
C     PRINT INPUT VALUES                                                SR2  88 
      WRITE (JTAPE,147)                                                 SR2  89 
      WRITE (JTAPE,156)                                                 SR2  90 
      DO 5 J=1,NS                                                       SR2  91 
      WRITE (JTAPE,157) J                                               SR2  92 
5     WRITE (JTAPE,158) (PD(I,J),I=1,NV)                                SR2  93 
      DO 7 J=1,NS                                                       SR2  94 
C     *** INSERT CALL TO FAST SORT SUBROUTINE HERE THAT TAKES ADVANTAGE SR2  95 
C     OF PARTIAL ORDERING.                                              SR2  96 
      CALL ORDER (-1,NV,PD(1,J),ISIM,INDEXI(1,J))                       SR2  97 
      S=0.                                                              SR2  98 
      DO 6 I=1,NV                                                       SR2  99 
      S=S+1.                                                            SR2 100 
      KK=INDEXI(I,J)+NS                                                 SR2 101 
6     DIST(J,KK)=S                                                      SR2 102 
7     CONTINUE                                                          SR2 103 
C     PREPARE MATRIX FOR OBTAINING INITIAL CONFIGURATION                SR2 104 
      STR=2.*FN                                                         SR2 105 
      A=(2.*FNV+FNS)/STR                                                SR2 106 
      DO 8 I=1,NSM1                                                     SR2 107 
      DIST(I,I)=1.                                                      SR2 108 
      IP1=I+1                                                           SR2 109 
      DO 8 J=IP1,NS                                                     SR2 110 
      DIST(I,J)=A                                                       SR2 111 
8     DIST(J,I)=A                                                       SR2 112 
      DIST(NS,NS)=1.                                                    SR2 113 
      A=(2.*FNS+FNV)/STR                                                SR2 114 
      DO 9 I=NSP1,NSNVM1                                                SR2 115 
      DIST(I,I)=1.                                                      SR2 116 
      IP1=I+1                                                           SR2 117 
      DO 9 J=IP1,NSPNV                                                  SR2 118 
      DIST(I,J)=A                                                       SR2 119 
9     DIST(J,I)=A                                                       SR2 120 
      DIST(NSPNV,NSPNV)=1.                                              SR2 121 
C     CHECK FOR TIES                                                    SR2 122 
      NOTR=0                                                            SR2 123 
      DO 17 I=1,NS                                                      SR2 124 
      NTR(I)=0                                                          SR2 125 
      JJ=1                                                              SR2 126 
      II=-1                                                             SR2 127 
      KK=JJ                                                             SR2 128 
10    LL=1                                                              SR2 129 
      MM=INDEXI(JJ,I)                                                   SR2 130 
      MMM=MM+NS                                                         SR2 131 
      S=DIST(I,MMM)                                                     SR2 132 
11    KK=KK+1                                                           SR2 133 
      NN=INDEXI(KK,I)                                                   SR2 134 
      IF (PD(MM,I)-PD(NN,I)) 13,12,13                                   SR2 135 
12    LL=LL+1                                                           SR2 136 
      NOTR=NOTR+1                                                       SR2 137 
      NNN=NN+NS                                                         SR2 138 
      S=S+DIST(I,NNN)                                                   SR2 139 
      IF (KK-NV) 11,14,14                                               SR2 140 
13    IF (LL-2) 16,14,14                                                SR2 141 
14    II=II+2                                                           SR2 142 
      NTR(I)=NTR(I)+2                                                   SR2 143 
      NOTYR(I,II)=LL                                                    SR2 144 
      NOTYR(I,II+1)=JJ                                                  SR2 145 
      S=S/FLOAT(LL)                                                     SR2 146 
      IJ=JJ                                                             SR2 147 
      DO 15 KL=1,LL                                                     SR2 148 
      MMM=INDEXI(IJ,I)+NS                                               SR2 149 
      DIST(I,MMM)=S                                                     SR2 150 
15    IJ=IJ+1                                                           SR2 151 
16    JJ=KK                                                             SR2 152 
      IF (JJ-NV) 10,17,17                                               SR2 153 
17    CONTINUE                                                          SR2 154 
      DO 18 I=1,NS                                                      SR2 155 
      DO 18 J=NSP1,NSPNV                                                SR2 156 
      DIST(I,J)=DIST(I,J)/FN                                            SR2 157 
18    DIST(J,I)=DIST(I,J)                                               SR2 158 
      DO 20 I=1,NSPNV                                                   SR2 159 
      DO 20 J=1,NSPNV                                                   SR2 160 
      IF (I-J) 19,20,19                                                 SR2 161 
19    DIST(I,I)=DIST(I,I)+DIST(I,J)                                     SR2 162 
20    CONTINUE                                                          SR2 163 
      DO 21 I=1,NSNVM1                                                  SR2 164 
      IP1=I+1                                                           SR2 165 
      DO 21 J=IP1,NSPNV                                                 SR2 166 
      DIST(I,J)=1.-DIST(I,J)                                            SR2 167 
21    DIST(J,I)=DIST(I,J)                                               SR2 168 
C     OBTAIN INITIAL CONFIGURATION                                      SR2 169 
      KK=MAXD+1                                                         SR2 170 
C     CALL ON HOUSEHOLDER SUBROUTINE                                    SR2 171 
      CALL EIGEN (DIST,C,NSPNV,STRESS,KK,MD,X(1,1),X(1,4),X(1,5),XP1(1,1SR2 172 
     1),XP1(1,2),XP1(1,3))                                              SR2 173 
      DO 22 J=2,KK                                                      SR2 174 
      STRESS(J-1)=STRESS(J)                                             SR2 175 
      DO 22 I=1,NSPNV                                                   SR2 176 
22    X(I,J-1)=C(I,J)                                                   SR2 177 
C     INITIALIZE                                                        SR2 178 
      ITER=100                                                          SR2 179 
      PRESTR=1.                                                         SR2 180 
      A=1.                                                              SR2 181 
      ASSIGN 43 TO N1                                                   SR2 182 
      LFACT=1                                                           SR2 183 
C     DETERMINE WHETHER TO GO UP OR DOWN                                SR2 184 
      IF (MIND) 23,23,30                                                SR2 185 
23    DIM=NSNVM1*2                                                      SR2 186 
      DIM=FNR**2/DIM                                                    SR2 187 
      II=0                                                              SR2 188 
      DO 25 J=1,MAXD                                                    SR2 189 
      IF (STRESS(J)-DIM) 26,24,24                                       SR2 190 
24    II=II+1                                                           SR2 191 
25    CONTINUE                                                          SR2 192 
26    IF (II) 27,27,28                                                  SR2 193 
27    MAXD=1                                                            SR2 194 
      GO TO 29                                                          SR2 195 
28    MAXD=II                                                           SR2 196 
29    MIND=MAXD                                                         SR2 197 
      LFACT=0                                                           SR2 198 
      ITER=25                                                           SR2 199 
30    M=MIND-1                                                          SR2 200 
C     BEGIN LEAST-SQUARES-RANK-IMAGES ITERATIONS                        SR2 201 
31    II=0                                                              SR2 202 
      JJ=0                                                              SR2 203 
      M=M+1                                                             SR2 204 
      NTIER=NOTR                                                        SR2 205 
32    II=II+1                                                           SR2 206 
33    ITCT=0                                                            SR2 207 
C     CALCULATE DISTANCES                                               SR2 208 
34    IF (IFCB) 35,38,35                                                SR2 209 
35    DO 37 I=1,NS                                                      SR2 210 
      KK=0                                                              SR2 211 
      DO 37 J=NSP1,NSPNV                                                SR2 212 
      KK=KK+1                                                           SR2 213 
      DIST(I,KK)=0.                                                     SR2 214 
      DO 36 K=1,M                                                       SR2 215 
36    DIST(I,KK)=DIST(I,KK)+ABS(X(I,K)-X(J,K))                          SR2 216 
37    DIST(J,I)=DIST(I,KK)                                              SR2 217 
      GO TO 41                                                          SR2 218 
38    DO 40 I=1,NS                                                      SR2 219 
      KK=0                                                              SR2 220 
      DO 40 J=NSP1,NSPNV                                                SR2 221 
      KK=KK+1                                                           SR2 222 
      DIST(I,KK)=0.                                                     SR2 223 
      DO 39 K=1,M                                                       SR2 224 
39    DIST(I,KK)=DIST(I,KK)+(X(I,K)-X(J,K))**2                          SR2 225 
      DIST(I,KK)=SQRT(DIST(I,KK))                                       SR2 226 
40    DIST(J,I)=DIST(I,KK)                                              SR2 227 
41    IF (ITCT) 67,42,67                                                SR2 228 
42    GO TO N1, (43,45)                                                 SR2 229 
43    DO 44 J=1,NS                                                      SR2 230 
C     *** CALL ON SORT SUBROUTINE.                                      SR2 231 
44    CALL ORDER (0,0,DIST(NSP1,J),0,INDEXJ(1,J))                       SR2 232 
      ASSIGN 45 TO N1                                                   SR2 233 
      GO TO 47                                                          SR2 234 
45    DO 46 J=1,NS                                                      SR2 235 
C     *** CALL ON SORT.                                                 SR2 236 
46    CALL ORDER (1,0,DIST(NSP1,J),0,INDEXJ(1,J))                       SR2 237 
47    IF (NTIER) 58,58,48                                               SR2 238 
C     OPTIMALLY PERMUTE TIES ON FIRST AND LAST ITERATION                SR2 239 
48    NTIER=0                                                           SR2 240 
      DO 57 I=1,NS                                                      SR2 241 
      IF (NTR(I)) 49,57,49                                              SR2 242 
49    KK=NTR(I)                                                         SR2 243 
      DO 56 J=1,KK,2                                                    SR2 244 
      LL=NOTYR(I,J)                                                     SR2 245 
      MM=NOTYR(I,J+1)                                                   SR2 246 
      NN=MM                                                             SR2 247 
      DO 50 K=1,LL                                                      SR2 248 
      IJ=INDEXI(NN,I)                                                   SR2 249 
      EVAL(K)=DIST(I,IJ)                                                SR2 250 
      IND(K,1)=IJ                                                       SR2 251 
50    NN=NN+1                                                           SR2 252 
      IJ=LL-1                                                           SR2 253 
51    JI=0                                                              SR2 254 
      DO 53 L=1,IJ                                                      SR2 255 
      LP1=L+1                                                           SR2 256 
      DO 53 N=LP1,LL                                                    SR2 257 
      IF (EVAL(N)-EVAL(L)) 52,53,53                                     SR2 258 
52    S=EVAL(L)                                                         SR2 259 
      EVAL(L)=EVAL(N)                                                   SR2 260 
      EVAL(N)=S                                                         SR2 261 
      JI=1                                                              SR2 262 
      NN=IND(L,1)                                                       SR2 263 
      IND(L,1)=IND(N,1)                                                 SR2 264 
      IND(N,1)=NN                                                       SR2 265 
53    CONTINUE                                                          SR2 266 
      IF (JI) 54,54,51                                                  SR2 267 
54    NN=MM                                                             SR2 268 
      DO 55 KL=1,LL                                                     SR2 269 
      INDEXI(NN,I)=IND(KL,1)                                            SR2 270 
55    NN=NN+1                                                           SR2 271 
56    CONTINUE                                                          SR2 272 
57    CONTINUE                                                          SR2 273 
C     RANK-IMAGE PERMUTATIONS                                           SR2 274 
58    DO 59 J=1,NS                                                      SR2 275 
      DO 59 I=1,NV                                                      SR2 276 
      KK=INDEXI(I,J)                                                    SR2 277 
      LL=INDEXJ(I,J)                                                    SR2 278 
59    PD(KK,J)=DIST(J,LL)                                               SR2 279 
      IF (JJ) 99,60,99                                                  SR2 280 
60    IF (NOTR) 61,67,61                                                SR2 281 
C     TIE TIES                                                          SR2 282 
61    DO 66 I=1,NS                                                      SR2 283 
      IF (NTR(I)) 62,66,62                                              SR2 284 
62    KK=NTR(I)                                                         SR2 285 
      DO 65 J=1,KK,2                                                    SR2 286 
      LL=NOTYR(I,J)                                                     SR2 287 
      MM=NOTYR(I,J+1)                                                   SR2 288 
      NN=MM                                                             SR2 289 
      S=0.                                                              SR2 290 
      DO 63 K=1,LL                                                      SR2 291 
      IJ=INDEXI(NN,I)                                                   SR2 292 
      S=S+PD(IJ,I)                                                      SR2 293 
63    NN=NN+1                                                           SR2 294 
      NN=MM                                                             SR2 295 
      S=S/FLOAT(LL)                                                     SR2 296 
      DO 64 L=1,LL                                                      SR2 297 
      IJ=INDEXI(NN,I)                                                   SR2 298 
      PD(IJ,I)=S                                                        SR2 299 
64    NN=NN+1                                                           SR2 300 
65    CONTINUE                                                          SR2 301 
66    CONTINUE                                                          SR2 302 
C     TEST FOR ZERO DISTANCE                                            SR2 303 
67    DO 68 J=1,NS                                                      SR2 304 
      KK=INDEXJ(1,J)                                                    SR2 305 
      IF (DIST(J,KK)) 68,69,68                                          SR2 306 
68    CONTINUE                                                          SR2 307 
      GO TO 72                                                          SR2 308 
69    DO 70 I=2,NV                                                      SR2 309 
      KK=INDEXJ(I,J)                                                    SR2 310 
      IF (DIST(J,KK)) 71,70,71                                          SR2 311 
70    CONTINUE                                                          SR2 312 
71    LL=INDEXJ(NV,J)                                                   SR2 313 
      GL=DIST(J,LL)/DIST(J,KK)                                          SR2 314 
      GO TO 73                                                          SR2 315 
72    GL=0.                                                             SR2 316 
73    DO 79 I=1,NS                                                      SR2 317 
      MM=NS                                                             SR2 318 
      DO 79 J=1,NV                                                      SR2 319 
      MM=MM+1                                                           SR2 320 
      IF (GL) 74,78,74                                                  SR2 321 
74    IF (PD(J,I)+DIST(I,J)) 76,75,76                                   SR2 322 
75    C(MM,I)=1.                                                        SR2 323 
      GO TO 79                                                          SR2 324 
76    IF (DIST(I,J)) 78,77,78                                           SR2 325 
77    C(MM,I)=GL                                                        SR2 326 
      GO TO 79                                                          SR2 327 
78    C(MM,I)=PD(J,I)/DIST(I,J)                                         SR2 328 
79    CONTINUE                                                          SR2 329 
C     PREPARE CORRECTION MATRIX                                         SR2 330 
      DO 80 I=NSP1,NSPNV                                                SR2 331 
      C(I,I)=FNV                                                        SR2 332 
      DO 80 J=1,NS                                                      SR2 333 
80    C(I,I)=C(I,I)+C(I,J)                                              SR2 334 
      DO 81 J=1,NS                                                      SR2 335 
      C(J,J)=FNS                                                        SR2 336 
      DO 81 I=NSP1,NSPNV                                                SR2 337 
81    C(J,J)=C(J,J)+C(I,J)                                              SR2 338 
      DO 82 I=NSP1,NSPNV                                                SR2 339 
      DO 82 J=1,NS                                                      SR2 340 
82    C(I,J)=1.-C(I,J)                                                  SR2 341 
C     APPLY CORRECTIONS                                                 SR2 342 
      DO 84 K=1,M                                                       SR2 343 
      DO 84 I=1,NS                                                      SR2 344 
      XP1(I,K)=X(I,K)*C(I,I)                                            SR2 345 
      DO 83 J=NSP1,NSPNV                                                SR2 346 
83    XP1(I,K)=XP1(I,K)+X(J,K)*C(J,I)                                   SR2 347 
84    XP1(I,K)=XP1(I,K)/FNR                                             SR2 348 
      DO 86 K=1,M                                                       SR2 349 
      DO 86 I=NSP1,NSPNV                                                SR2 350 
      XP1(I,K)=X(I,K)*C(I,I)                                            SR2 351 
      DO 85 J=1,NS                                                      SR2 352 
85    XP1(I,K)=XP1(I,K)+X(J,K)*C(I,J)                                   SR2 353 
86    XP1(I,K)=XP1(I,K)/FNR                                             SR2 354 
      DO 87 K=1,M                                                       SR2 355 
      DO 87 I=1,NSPNV                                                   SR2 356 
87    X(I,K)=XP1(I,K)                                                   SR2 357 
      ITCT=ITCT+1                                                       SR2 358 
      IF (10-ITCT) 88,88,34                                             SR2 359 
C     COMPUTE NORMALIZED PHI                                            SR2 360 
88    S=0.                                                              SR2 361 
      STR=0.                                                            SR2 362 
      DO 89 I=1,NS                                                      SR2 363 
      DO 89 J=1,NV                                                      SR2 364 
      S=S+DIST(I,J)**2                                                  SR2 365 
89    STR=STR+(DIST(I,J)-PD(J,I))**2                                    SR2 366 
      STR=STR/(2.*S)                                                    SR2 367 
      STRESS(II)=STR                                                    SR2 368 
C     TEST FOR TERMINATION                                              SR2 369 
      IF (II-6) 32,90,90                                                SR2 370 
90    IF (STRESS(II-5)-STRESS(II)-1E-06) 92,92,91                       SR2 371 
91    IF (II-ITER) 32,92,92                                             SR2 372 
92    IF (LFACT) 95,95,93                                               SR2 373 
93    IF (PRESTR-STR) 144,144,94                                        SR2 374 
94    PRESTR=STR                                                        SR2 375 
95    WRITE (JTAPE,147)                                                 SR2 376 
      WRITE (JTAPE,150) M,(KK,KK=1,M)                                   SR2 377 
      GO TO (96,97), M1                                                 SR2 378 
96    WRITE (JTAPE,151)                                                 SR2 379 
      GO TO 98                                                          SR2 380 
97    WRITE (JTAPE,161)                                                 SR2 381 
98    JJ=1                                                              SR2 382 
      NTIER=NOTR                                                        SR2 383 
      GO TO 33                                                          SR2 384 
C     COMPUTE INDIVIDUAL PHI'S                                          SR2 385 
99    S=0.                                                              SR2 386 
      DO 100 I=1,NS                                                     SR2 387 
      PHI(I)=0.                                                         SR2 388 
      DO 100 J=1,NV                                                     SR2 389 
      S=S+DIST(I,J)**2                                                  SR2 390 
100   PHI(I)=PHI(I)+(DIST(I,J)-PD(J,I))**2                              SR2 391 
      STR=0.                                                            SR2 392 
      S=2.*S                                                            SR2 393 
      DO 101 J=1,NS                                                     SR2 394 
      PHI(J)=PHI(J)/S                                                   SR2 395 
101   STR=STR+PHI(J)                                                    SR2 396 
      IF (M-2) 107,102,102                                              SR2 397 
102   IF (IFCB) 107,103,107                                             SR2 398 
C     PERFORM PRINCIPAL AXIS ROTATION                                   SR2 399 
103   DO 105 I=1,NSPNV                                                  SR2 400 
      DO 105 J=I,NSPNV                                                  SR2 401 
      DIST(I,J)=0.                                                      SR2 402 
      DO 104 K=1,M                                                      SR2 403 
104   DIST(I,J)=DIST(I,J)+X(I,K)*X(J,K)                                 SR2 404 
105   DIST(J,I)=DIST(I,J)                                               SR2 405 
C     CALL ON HOUSEHOLDER SUBROUTINE                                    SR2 406 
      CALL EIGEN (DIST,C,NSPNV,STRESS,M,MD,XP1(1,1),XP1(1,4),XP1(1,5),XPSR2 407 
     11(1,6),PD(1,1),PD(1,3))                                           SR2 408 
      DO 106 J=1,M                                                      SR2 409 
      DO 106 I=1,NSPNV                                                  SR2 410 
106   X(I,J)=C(I,J)                                                     SR2 411 
C     NORMALIZE COORDINATES TO LIE IN RANGE -1 TO +1                    SR2 412 
107   A=0.                                                              SR2 413 
      DO 109 K=1,M                                                      SR2 414 
      C(1,K)=X(1,K)                                                     SR2 415 
      C(2,K)=X(1,K)                                                     SR2 416 
      DO 108 I=2,NSPNV                                                  SR2 417 
      C(1,K)=AMIN1(C(1,K),X(I,K))                                       SR2 418 
108   C(2,K)=AMAX1(C(2,K),X(I,K))                                       SR2 419 
109   A=AMAX1(A,(C(2,K)-C(1,K)))                                        SR2 420 
      A=2./A                                                            SR2 421 
      DO 110 K=1,M                                                      SR2 422 
      DO 110 I=1,NSPNV                                                  SR2 423 
110   XP1(I,K)=A*(X(I,K)-C(1,K))-1.                                     SR2 424 
C     COMPUTE CENTRALITY INDEX                                          SR2 425 
      KK=M+1                                                            SR2 426 
      DO 114 I=1,NSPNV                                                  SR2 427 
      XP1(I,KK)=0.                                                      SR2 428 
      DO 111 K=1,M                                                      SR2 429 
111   XP1(I,KK)=XP1(I,KK)+X(I,K)**2                                     SR2 430 
      IF (IFCB) 112,113,112                                             SR2 431 
112   XP1(I,KK)=A*XP1(I,KK)                                             SR2 432 
      GO TO 114                                                         SR2 433 
113   XP1(I,KK)=A*SQRT(XP1(I,KK))                                       SR2 434 
114   CONTINUE                                                          SR2 435 
C     PRINT RESULTS                                                     SR2 436 
      DO 115 I=1,NS                                                     SR2 437 
115   WRITE (JTAPE,152) I,PHI(I),(XP1(I,K),K=1,KK)                      SR2 438 
      GO TO (116,117), M1                                               SR2 439 
116   WRITE (JTAPE,159)                                                 SR2 440 
      GO TO 118                                                         SR2 441 
117   WRITE (JTAPE,162)                                                 SR2 442 
118   DO 119 I=NSP1,NSPNV                                               SR2 443 
119   WRITE (JTAPE,160) I,(XP1(I,K),K=1,KK)                             SR2 444 
      CAL=SQRT(1.-(1.-STR)**2)                                          SR2 445 
      WRITE (JTAPE,153) STR,II,CAL                                      SR2 446 
      IF (LFACT) 120,132,120                                            SR2 447 
120   IF (M-2) 142,121,121                                              SR2 448 
C     CALL PLOT SUBROUTINE                                              SR2 449 
121   CALL PLOT (XP1,C(1,1),C(1,2),C(1,3),C(1,4),C(1,5),NSPNV,M,MD,ND)  SR2 450 
      IF (IFC) 122,124,122                                              SR2 451 
122   DO 123 I=1,NSPNV                                                  SR2 452 
123   PUNCH 155, (XP1(I,J),J=1,M)                                       SR2 453 
124   IF (IFD) 125,142,125                                              SR2 454 
125   IF (IFCB) 129,126,129                                             SR2 455 
126   DO 128 I=1,NSNVM1                                                 SR2 456 
      DIST(I,I)=0.                                                      SR2 457 
      IP1=I+1                                                           SR2 458 
      DO 128 J=IP1,NSPNV                                                SR2 459 
      DIST(J,I)=0.                                                      SR2 460 
      DO 127 K=1,M                                                      SR2 461 
127   DIST(J,I)=DIST(J,I)+(XP1(I,K)-XP1(J,K))**2                        SR2 462 
128   DIST(J,I)=SQRT(DIST(J,I))                                         SR2 463 
      GO TO 131                                                         SR2 464 
129   DO 130 I=1,NSNVM1                                                 SR2 465 
      DIST(I,I)=0.                                                      SR2 466 
      IP1=I+1                                                           SR2 467 
      DO 130 J=IP1,NSPNV                                                SR2 468 
      DIST(J,I)=0.                                                      SR2 469 
      DO 130 K=1,M                                                      SR2 470 
130   DIST(J,I)=DIST(J,I)+ABS(XP1(I,K)-XP1(J,K))                        SR2 471 
131   DIST(NSPNV,NSPNV)=0.                                              SR2 472 
      CALL MXOUT (DIST,NSPNV,1,MD)                                      SR2 473 
      GO TO 142                                                         SR2 474 
132   IF (IFCB) 133,134,133                                             SR2 475 
133   WRITE (JTAPE,154)                                                 SR2 476 
      GO TO 163                                                         SR2 477 
C     DETERMINE HOW MANY DIMENSIONS TO DROP                             SR2 478 
134   LL=1                                                              SR2 479 
      KK=M                                                              SR2 480 
      DO 136 J=2,KK                                                     SR2 481 
      S=STRESS(J)/STRESS(1)                                             SR2 482 
      IF (S-.3) 137,137,135                                             SR2 483 
135   LL=LL+1                                                           SR2 484 
136   CONTINUE                                                          SR2 485 
137   M=LL-1                                                            SR2 486 
      MAXD=LL                                                           SR2 487 
      IF (ITER-100) 138,139,139                                         SR2 488 
138   ITER=ITER+25                                                      SR2 489 
139   IF (KK-LL) 140,140,31                                             SR2 490 
140   LFACT=1                                                           SR2 491 
      IF (M) 144,144,141                                                SR2 492 
141   M=M+1                                                             SR2 493 
      GO TO 121                                                         SR2 494 
142   IF (.000001-STR) 143,144,144                                      SR2 495 
143   IF (M-MAXD) 31,144,144                                            SR2 496 
144   GO TO (145,163), MU                                               SR2 497 
145   MM=NS                                                             SR2 498 
      NS=NV                                                             SR2 499 
      NV=MM                                                             SR2 500 
      MU=2                                                              SR2 501 
      M1=2                                                              SR2 502 
      DO 146 I=1,NV                                                     SR2 503 
146   READ (13'KT) (PD(I,J),J=1,NS)                                     SR2 504 
      GO TO 4                                                           SR2 505 
C     *** FORMAT STATEMENTS ***                                         SR2 506 
C                                                                       SR2 507 
147   FORMAT (72H                                                       SR2 508 
     1                 )                                                SR2 509 
148   FORMAT (9I4)                                                      SR2 510 
149   FORMAT (18A4)                                                     SR2 511 
150   FORMAT (33H0G-L(SSAR-II) COORDINATES FOR M =,I3,1H./1H0,9X10H DIMESR2 512 
     1NSION,10I10)                                                      SR2 513 
151   FORMAT (1H ,130(1H-)/6H0  ROW,8X6HN. PHI)                         SR2 514 
152   FORMAT (I5,5XF10.5,2P11F10.3)                                     SR2 515 
153   FORMAT (17H0NORMALIZED PHI =,F7.5,4H FOR,I4,11H ITERATIONS/28H COESR2 516 
     1FFICIENT OF ALIENATION =,E12.6)                                   SR2 517 
154   FORMAT (27H0ERROR - IFCB=1 AND MIND=0.)                           SR2 518 
155   FORMAT (9F8.5)                                                    SR2 519 
156   FORMAT (19H0INPUT COEFFICIENTS)                                   SR2 520 
157   FORMAT (4H0ROW,I3)                                                SR2 521 
158   FORMAT (10F13.4)                                                  SR2 522 
159   FORMAT (8H0 COLUMN)                                               SR2 523 
160   FORMAT (I5,15X2P11F10.3)                                          SR2 524 
161   FORMAT (1H ,130(1H-)/8H0 COLUMN,6X6HN. PHI)                       SR2 525 
162   FORMAT (6H0  ROW)                                                 SR2 526 
      END                                                               SR2 527-
1DIAGNOSIS AND MMPI PROFILE TYPE (MARKS AND SEEMAN, APPENDIX A, P. 222).        
   5  16   3   3   1   1   1                                                    
(16F2.0)                                                                        
18 5 0 514 5 9 0 0 0 0 014 9 023                                                
 4 6 2 9 9 2 5 7 111 2 6 91011 6                                                
21 0 8 0 02521 0 8 0 0 8 0 4 4 0                                                
1119 911 315 5 0 5 3 0 9 0 4 1 4                                                
 0 110 1 1 1 61318 724 3 6 0 1 4                                                
1TEST OF U-FUNCTION - ROW SOLUTION AND COLUMN SOLUTION.                         
   5   3       2   1                                                            
(3F2.0)                                                                         
 2 110                                                                          
 3 9 4                                                                          
 9 3 1                                                                          
 410 5                                                                          
 1 211                                                                          
