Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-02 - decus/20-0036/fisher.bas
There is 1 other file named fisher.bas in the archive. Click here to see a list.
1'     NAME-- FISHER
2'
3'     DESCRIPTION -- COMPUTES THE PROBABILITY OF OBTAINING SCORES
4'             BY CHANCE USING THE FISHER METHOD OF RANDOMIZATION.
5'
6'     SOURCE -- J. D. PERRY, UNIVERSITY OF VERMONT
7'     
8'     REFERENCE -- BRADLEY, "DISTRIBUTION-FREE STATISTICAL TESTS"
9'                  1968, CHAPTER 4
10' 
11'    INSTRUCTIONS -- INSERT DATA IN LINE 50FF AS FOLLOWS:
12'     FIRST, THE TOTAL NUMBER OF SUBJECTS, THEN THE NUMBER
13'     OF TREATMENT GROUPS (USUALLY TWO), THEN THE SUBJECTS'
14'     SCORES, STARTING WITH THE LOWEST SCORING GROUP FOR THE
15'     SAKE OF THE PROGRAM'S EFFICIENCY.
16'     NOTE.- THE PROGRAM REQUIRES EQUAL N GROUPS.
17'     NOTE.- THE PROGRAM CANNOT HANDLE NEGATIVE SCORES (ADD A
18'     CONSTANT TO ALL SCORES TO ELIMINATE THEM),NOR ZEROS (SAME
19'     SOLUTION), NOR TIES IN SCORE (FUDGE).
20'
21'    *     *     *     MAIN PROGRAM     *     *     *
22'
50 DATA 10,2, 5,4,3,2,6,1,7,8,9,10
100    PRINT "OUR DATA...";
110    DIM S(24)
120    DIM F(100)
130    READ N
140    READ G
150    FOR I = 1 TO N
160    READ S(I)
170    PRINT S(I);
180    NEXT I
190    PRINT
200    LET H = N/G
210    FOR I = 1 TO H
220    LET S6 = S6 + S(I)
230    NEXT I
240    FOR I = 2 TO N
250    ON SGN(S(I)-S(I-1))+2 GO TO 260,360,360
260    LET T2 = S(I)
270    LET I2 = I-1
280    FOR J = 1 TO I2
290    LET L = I - J
300    ON SGN(T2-S(L))+2 GO TO 310,350,350
310    LET S(L+1) = S(L)
320    NEXT J
330    LET S(1) = T2
340    GO TO 360
350    LET S(L+1) = T2
360    NEXT I
370    FOR I = 1 TO N
380    LET R(I) = S(I)
390    NEXT I
440    PRINT "OUR DATA SUMS TO ... ";S6
445     PRINT
450    PRINT "------COMBINATIONS AS EXTREME AS OURS-------------"
460    FOR W = H+1 TO 10
470    LET T(W) = 100 + W
480    NEXT W
600 FOR I = 1 TO (N-H+1)
610    LET T(1) = R(I)
620    IF H > 1 GO TO 650
630    GOSUB 2000
640    GO TO 1950
650    FOR J = 2 TO (N-H+2)
660       LET T(2) = R(J)
670       IF H > 2 GO TO 700
680       GOSUB 2000
690       GO TO 1940
700       FOR K = 3 TO (N-H+3)
710          LET T(3) = R(K)
720          IF H > 3 GO TO 750
730          GOSUB 2000
740          GO TO 1930
750          FOR L = 4 TO (N-H+4)
760             LET T(4) = R(L)
770             IF H > 4 GO TO 800
780             GOSUB 2000
790             GO TO 1920
800             FOR M = 5 TO (N-H+5)
810                LET T(5) = R(M)
820                IF H > 5 GO TO 850
830                GOSUB 2000
840                GO TO 1910
850                FOR P = 6 TO (N-H+6)
860                   LET T(6) = R(P)
870                   IF H > 6 GO TO 2400
880                   GOSUB 2000
890                   GO TO 1900
1900               NEXT P
1910            NEXT M
1920         NEXT L
1930      NEXT K
1940   NEXT J
1950 NEXT I
1969 PRINT "---------------------------------------------------"
1970 PRINT "THE TOTAL NUMBER OF COMBINATIONS IS ... ";Y
1971 LET X=Q
1972 PRINT "THE NO. OF COMBINATIONS AS EXTREME AS OURS ..";X
1973 LET P=(X/Y)*100
1974 PRINT "THIS GIVES US A PROBABILITY OF";P;"%"
1975 GO TO 2300
2000 '   THIS SECTION TESTS FOR COMBINATIONS
2001 IF T(1) >= T(2) GO TO 2060
2002 IF T(2) >= T(3) GO TO 2060
2003 IF T(3) >= T(4) GO TO 2060
2004 IF T(4) >= T(5) GO TO 2060
2005 IF T(5) >= T(6) GO TO 2060
2006 
2007 LET T2 = 0
2008 LET Y = Y + 1
2010 FOR Z = 1 TO H
2020 LET T2 = T2 + T(Z)
2025 
2040 NEXT Z
2043 GOSUB 2200
2044 IF T2 > S6 GO TO 2060
2046 FOR Z = 1 TO H
2047 PRINT T(Z);
2049 NEXT Z
2050 PRINT TAB(18)"SUM =";T2
2055 LET Q=Q+1
2056 PRINT
2060 RETURN
2070 RETURN
2200 LET A = T2
2210 LET V2 = V2 + 1
2220 LET F(A) = F(A) + 1
2230 RETURN
2300 LET B = B + 1
2310 IF F(B) = 0 GO TO 2300
2314 PRINT
2315 PRINT "--------FREQUENCY DISTRIBUTION---------"
2320 FOR C = B TO V2
2325 IF F(C) = 0 GO TO 2350
2330 PRINT "SUM =";C;TAB(10)".";TAB(F(C)*2+10);F(C)
2340 NEXT C
2350 STOP
2400 PRINT "SORRY, I CAN'T HANDLE THIS PROBBLEM"
2410 END