1 '*********************************************************************
3 '***********  LL.BAS  ************************************************
5 '*********************************************************************
6 '     NCYCLE = NUMBER OF REPEATS OF PATTERNS FOR LAST WAVE OF DATA
11 '      NPATT = NUMBER OF UNIQUE PATTERNS ACROSS WAVES
16 '      NSIZE = EQUALS NUMBER OF ONES AND INCREMENTS UNTIL NUMBER OF ITEMS
21 '              IS FILLED BY ZEROS
26 '       IEND = (NUMBER OF ITEMS X WAVES-1)
31 '    IICOMP$ = STRING OF ONES AND ZEROS ACROSS WAVES
36 '          I = NUMBER OF ONES IN LAST WAVE
41 '         II = NUMBER OF PATTERNS WITHIN EACH CYCLE OF COMMON STRINGS FOR LAST WAVE
46 '     IOLDI = SET EQUAL TO I
51 '    NCOUNT = NUMBER OF PATERNS WITHIN EACH CYCLE OF COMMON STRINGS
56 '             AFTER THE FIRST PATTERN
61 ' NNCYCLE-1 = NUMBER OF ONES IN SECOND FROM LAST WAVE OF ITEMS
66 '    NNSIZE = SET EQUAL TO NUMBER OF ONES AND THEN INCREMENTED
71 '   IOLDITT = SET EQUAL TO NNCYCLE
76 '   NNCOUNT = ONE GREATER THAN NUMBER OF ONES IN PATTERN
81 '     NZERO = NUMBER OF ZEROS
86 ' ---------------04-03-90----------------------------------------------------
91 ' ---------------------------------------------------------------------------
96  PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT
101  OPEN "I",#1,"LG.OUT":INPUT #1,HEADER$:INPUT #1,QUICK$:INPUT #1,QUICKIE$:INPUT #1,ITEMS:NSUBJ=0
102  OPEN "O",#2,"LG3.OUT"
103  PRINT #2," ":PRINT #2,"
":PRINT #2," ":
104  IF QUICKIE$="0" THEN GOTO 1151
110  OPEN "I",#3,"CHECKSUB":INPUT #3,NUM:IF NUM>1250 THEN GOTO 1151
146  DIM NTITLE(1250,4)
161  INPUT #1,TITLE$
166  NSUBJ=NSUBJ+1
171  IF MID$(TITLE$,1,1)="-" THEN NSUBJ=NSUBJ-1:GOTO 1141
176 FOR I=1 TO 80
181  IF MID$(TITLE$,I,1)="0" THEN IIZERO=IIZERO+1
186  IF MID$(TITLE$,I,1)="1" THEN IIONE=IIONE+1
191 NEXT I
196 ILENGTH=IIZERO+IIONE
201 IF NSUBJ>1 THEN GOTO 591
206 PRINT #2,"LONGITUDINAL SCALOGRAM ANALYSIS (LSA) PROGRAM (VERSION 2.1)":
211 PRINT #2,"                     BY R. D. HAYS":
216 PRINT #2,"                      RAND            ":PRINT #2," "
218 PRINT #2,HEADER$
226 NPATT=1
246 IWAVES=INT(ILENGTH/ITEMS):PRINT "WAVES= ";IWAVES
591  FOR ITE=1 TO IWAVES
596   NTITLE(NSUBJ,ITE)=0
601  NEXT ITE
606   FOR IREP=1 TO IWAVES
611    NSTEP=(IREP-1)*ITEMS
616     FOR IT=1 TO ITEMS
621      IF MID$(TITLE$,IT+NSTEP,1)="0" GOTO 631
626      NTITLE(NSUBJ,IREP)=NTITLE(NSUBJ,IREP)+(2^(ITEMS-IT))
631     NEXT IT
636   NEXT IREP
746 IF NSUBJ=1 THEN PRINT "SUBJECT NUMBER=  "
751 PRINT TAB(15);NSUBJ;
760  GOTO 161
1141 GOSUB 1386
1150  PRINT #2,"
"
1151 CLOSE
1156 SYSTEM
1161 END
1166 '*************************************
1386 '*************************************
1391  REM  SORT ERROR PATTERNS
1393  IHALF=1+INT((ITEMS-2)/2)
1396  PRINT #2,"----------------------------------------------------------------"
1401  PRINT #2," ": PRINT #2,"FREQUENCIES FOR ALL Response Patterns:  ":PRINT #2,
1406  PRINT #2,"       Pattern                          Frequency             "
1407  FOR IIII=1 TO IWAVES
1408    FOR IIIII=1 TO IHALF
1409    HEAD$=HEAD$+" "
1410    NEXT IIIII
1411     TMPSTR$=STR$(IWAVES+1-IIII):HEAD$=HEAD$+ "W"+MID$(TMPSTR$,2,1)
1412      FOR IIIII=1 TO IHALF
1413       HEAD$=HEAD$+" "
1414      NEXT IIIII
1415  NEXT IIII
1416  PRINT #2,HEAD$:PRINT #2,"_________________________________________________________":ILINES=12
1417 SS=0
1421  WHILE SS=0
1426  SS=1
1431     FOR I=1 TO NSUBJ-1
1436     IREP=1
1441      IF NTITLE(I,IREP)<>NTITLE(I+1,IREP) THEN GOTO 1456
1446        IF IREP=IWAVES THEN GOTO 1491
1451        IREP=IREP+1:GOTO 1441
1456      IF NTITLE(I,IREP)<NTITLE(I+1,IREP) THEN GOTO 1491
1461      IREP=1
1466      T=NTITLE(I,IREP)
1471      NTITLE(I,IREP)=NTITLE(I+1,IREP):NTITLE(I+1,IREP)=T
1476      IF IREP<IWAVES THEN IREP=IREP+1:GOTO 1466
1486  SS=0
1491     NEXT I
1496  WEND
1501  FOR IT=1 TO NSUBJ-1
1506   IREP=1
1511   IF NTITLE(IT,IREP)<>NTITLE(IT+1,IREP) THEN GOTO 1536
1516   IF IREP=IWAVES THEN NCOUNT=NCOUNT+1:GOTO 1586
1521   IREP=IREP+1:GOTO 1511
1526 '  ***************************************************
1536   IREP=1:NRUN=NTITLE(IT,IREP):TITLE$=""
1541    FOR IN=1 TO ITEMS
1546     II=ITEMS-IN
1551     IF NRUN>= 2^II THEN TITLE$=TITLE$+"1":NRUN=NRUN-2^II:GOTO 1561
1556     TITLE$=TITLE$+"0"
1561    NEXT IN
1566    IF IREP<IWAVES THEN IREP=IREP+1:NRUN=NTITLE(IT,IREP):TITLE$=TITLE$+" ":GOTO 1541
1576    PRINT #2,USING "&    : (####)";TITLE$,NCOUNT+1:ILINES=ILINES+1
1578    IF ILINES<61 THEN GOTO 1582
1579  PRINT #2,"
"
1580  PRINT #2,"  Pattern                             Frequency             "
1581  PRINT #2,HEAD$:PRINT #2,"_________________________________________________________":ILINES=3
1582    NCOUNT=0
1586  NEXT IT
1591   IREP=1:NRUN=NTITLE(NSUBJ,IREP):TITLE$=""
1596    FOR IN=1 TO ITEMS
1601     II=ITEMS-IN
1606     IF NRUN>= 2^II THEN TITLE$=TITLE$+"1":NRUN=NRUN-2^II:GOTO 1616
1611     TITLE$=TITLE$+"0"
1616    NEXT IN
1621    IF IREP<IWAVES THEN IREP=IREP+1:NRUN=NTITLE(NSUBJ,IREP):TITLE$=TITLE$+" ":GOTO 1596
1631    PRINT #2,USING "&    : (####)";TITLE$,NCOUNT+1
1633  PRINT #2," "
1636   RETURN