Trailing-Edge
-
PDP-10 Archives
-
decuslib20-01
-
decus/20-0020/walds.sta
There are 2 other files named walds.sta in the archive. Click here to see a list.
100' NAME--WALDS
110'
120' DESCRIPTION--COMPUTES THE IMPORTANT CHARACTERISTICS OF
130' WALDS SEQUENTIAL TEST PROCEDURE.
140'
150' SOURCE--DEAN MYRON TRIBUS,THAYER SCHOOL OF ENGINEERING,
160' DARTMOUTHE COLLEGE, HANOVER, N.H. 03755.
170'
180' INSTRUCTIONS--TYPE "RUN" AND FOLLOW THE INSTRUCTIONS.
190'
200'
210' * * * * * * * MAIN PROGRAM * * * * * * * * *
220'
230 PRINT "TO TEST HYPOTHESES H1 AND H2 WITH COST-K UNITS PER"
240 PRINT "DATA POINT. THERE ARE TWO POSSIBLE ACTS, A1 AND A2"
250 PRINT "THE REWARDS MATRIX IS AS FOLLOWS:"
260 PRINT " H1 TRUE H2 TRUE"
270 PRINT " ACT A1 W1 W2"
280 PRINT " ACT A2 W3 W4"
290 PRINT
300 PRINT "BEFORE TEST BEGINS P0 IS PROBABILITY H1 IS TRUE"
310 PRINT "SYMBOL G IS AN OUTCOME OF A TEST FAVORABLE TO A1"
320 PRINT "P(G/H1)=B1 AND P(G/H2)=B2"
330 PRINT
340 PRINT "INPUT P0,B1,B2,W1,W2,W3,W4,K"
350 INPUT P0,B1,B2,W1,W2,W3,W4,K
360 LET R1=W1-W3
370 LET R2=W4-W2
380 IF ABS(R1/R2)=R1/R2 THEN 420
390 PRINT "YOU HAVE NO PROBLEM. CONSULT THE REWARDS MATRIX AGAIN"
400 PRINT "IT TELLS YOU WHAT TO DO, INDEPENDENT OF ANY TEST"
410 STOP
420 LET C1=LOG(B1/B2)
430 LET C2=LOG((1-B1)/(1-B2))
440 LET Y1=B1*C1+(1-B1)*C2
450 LET Y2=B2*C1+(1-B2)*C2
460 LET L0=LOG(P0/(1-P0))
470 LET M1=(R1*Y1-R2*Y2)/K
480 LET M2=2-((R1*R2*Y1*Y2)/(K*K))
490 PRINT "PARAMETERS; P0=";P0;" B1=";B1;" B2=";B2
500 PRINT "R1=";R1;" R2=";R2;" Y1=";Y1;" Y2=";Y2
510 PRINT "L0=";L0;" M1=";M1" M2=";M2
520 DEF FNZ(Z)=M2+(Z*Z)-(M1*Z)-EXP(Z)-EXP(-Z)
530 LET Z9=1
540 LET Z0=0.001
550 LET Z4=10
560 IF FNZ(Z4)<0 THEN 590
570 LET Z4=2*Z4
580 GO TO 560
590 PRINT Z4
600 IF (Z4/Z0)<1E-5 THEN 730
610 LET X(0)=Z0
620 LET X(1)=Z0+(Z4/4)
630 LET X(2)=Z0 + (Z4/2)
640 LET X(3)=Z0 + (3*Z4/4)
650 LET X(4)=Z0+Z4
660 FOR I=0 TO 4
670 IF FNZ(X(I))*FNZ(X(I+1))>0 THEN 720
680 LET Z0=X(I)
690 LET Z4=X(I+1)-X(I)
700 LET Z9=Z9+1
710 GO TO 590
720 NEXT I
730 LET Z=X(2)
740 PRINT
750 PRINT "Z=";Z" IN";Z9;" TRIALS"
760 LET X=1-EXP(Z)-(R1*Y1/K)+Z
770 LET X=(1-EXP(-Z)-(R2*Y2/K)-Z)/X
780 LET O2=X*Y1/Y2
790 LET O1=Z+LOG(O2)
800 LET P1=O1/(1+O1)
810 LET P2=O2/(1+O2)
820 LET Q1=(P0-P2)/(P1-P2)
830 LET L1=LOG(O1)
840 LET L2=LOG(O2)
850 LET L0=LOG(P0/(1-P0))
860 LET P(1,1)=Q1*P1/P0
870 LET P(1,2)=((1-P0)-(1-Q1)*(1-P2))/(1-P0)
880 LET P(2,1)=(P0-Q1*P1)/P0
890 LET P(2,2)=(1-Q1)*(1-P2)/(1-P0)
900 LET N=((L1-L0)*P1*Q1+(L2-L0)*P2*(1-Q1))/Y1
910 LET N=N+((L1-L0)*(1-P1)*Q1+(L2-L0)*(1-P2)*(1-Q1))/Y2
920 LET W=(W1*P1+W2*(1-P1))*Q1+(W3*P2+W4*(1-P2))*(1-Q1)
930 LET V=W-K*N
940 PRINT "V=";V;" N=";N;" W=";W
950 PRINT "L0,L1 AND L2 AT";L0;L1;L2;" NAPIERS"
960 PRINT "P0,P1,P2="P0;P1;P2
970 PRINT "P(A1/H1)=";P(1,1);" P(A2/H2)=";P(2,2)
980 PRINT "P(A2/H1)=";P(2,1);" P(A1/H2)=";P(1,2)
990 PRINT "P(H1/A1)=";P1;" P(H2/A1)=";1-P1
1000 PRINT "P(H1/A2)=";P2;" P(H2/A2)=";1-P2
1010 PRINT "P(G/A1)=";B1*P1+B2*(1-P1)
1020 END