Trailing-Edge
-
PDP-10 Archives
-
decuslib10-06
-
43,50422/cmod76.bas
There are 2 other files named cmod76.bas in the archive. Click here to see a list.
00020REM *********************************************************************
00030REM CMOD76 CMOD76 CMOD76 CMOD76 CMOD76
00040REM************************************************************************
00050REM PRIOR FOR SIMULTANEOUS ESTIMATION OF MEANS LINDLEY
00060REM
00070FILES RFILE1,RFILE2,RFILE3, , , , , ,RF9
00110RESTORE#1
00111 INPUT# 1,I1,I2,I3
00120SCRATCH#1
00121 PRINT # 1,76,I2,I3
00130X=0
00140S9=0
00150DATA .7407,1.5332,2.1318,.7176,1.4398,1.9432,.7064,1.3968,1.8595
00160DATA .6955,1.3562,1.7823
00170 DIM P(4,3)
00180MAT READ P
00190 DIM Z(3)
00200Z(1)=5
00210Z(2)=10
00220Z(3)=25
00222PRINT L$
00230PRINT " PRIOR DISTRIBUTION "
00240PRINT " FOR"
00250PRINT " SIMULTANEOUS ESTIMATION OF MEANS"
00260PRINT
00270PRINT "THIS MODULE ASSUMES THAT YOU HAVE EXCHANGEABLE BELIEFS ABOUT"
00280PRINT "THE GROUP MEANS. THE WITHIN GROUP VARIANCE IS ASSUMED EQUAL"
00290PRINT "FOR ALL GROUPS."
00300PRINT
00310PRINT "THIS MODULE WILL ASSIST YOU IN FITTING DISTRIBUTIONS TO YOUR"
00320PRINT "BELIEFS ABOUT"
00330PRINT " 1. THE GRAND MEAN OR AVERAGE OF THE GROUP MEANS"
00340PRINT " 2. THE MEAN OF A RANDOMLY SELECTED GROUP"
00350PRINT " 3. A RANDOMLY SELECTED OBSERVATION FROM A GROUP WITH "
00360PRINT " KOWN MEAN"
00370PRINT
00380PRINT "BY FITTING DISTRIBUTIONS TO YOUR BELIEFS ABOUT THESE VALUES"
00390PRINT "IT IS POSSIBLE TO INFER YOUR PRIOR DISTRIBUTIONS ON THE"
00400PRINT " 1. BETWEEN GROUP STANDARD DEVIATION"
00410PRINT " 2. WITHIN GROUP STANDARD DEVIATION"
00420PRINT
00430PRINT "WHEN YOU ARE READY TO CONTINUE TYPE '1'.";
00440GOSUB 9000
00450PRINT L$
00460PRINT " PRIOR DISTRIBUTION ON THE GRAND MEAN"
00470PRINT
00480PRINT "THE GRAND MEAN IS THE AVERAGE OF THE GROUP MEANS."
00490PRINT
00500PRINT "IT IS IMPORTANT THAT YOU KEEP IN MIND THAT YOU ARE BEING ASKED"
00510PRINT "ABOUT THE GRAND MEAN, AND NOT THE GROUP MEANS."
00520PRINT
00530PRINT "WHAT IS YOUR BEST ESTIMATE OF THE GRAND MEAN";
00540GOSUB 9000
00550M0=O1
00560PRINT L$
00570:BEST ESTIMATE =#######.##
00580PRINT USING 570,M0
00590PRINT
00600IF S9=1 THEN 680
00610PRINT "WHAT DO YOU THINK ARE REASONABLE LOWER AND UPPER BOUNDS ON"
00620PRINT "THE VALUE OF THE GRAND MEAN? REASONABLE MIGHT BE TAKEN"
00630PRINT "TO MEAN THAT YOU THINK THERE IS ONLY 1 CHANCE IN 20 THAT THE"
00640PRINT "THE GRAND MEAN IS LESS THAN THE LOWER BOUND, OR THAT IT IS"
00650PRINT "GREATER THAN THE UPPER BOUND. REMEMBER IT IS THE GRAND MEAN"
00660PRINT "WE ARE CONSIDERING."
00670PRINT
00680PRINT "WHAT IS YOUR LOWER BOUND";
00690GOSUB 9000
00700L0=O1
00710IF L0<M0 THEN 740
00720PRINT "REENTER. LOWER BOUND MUST BE LESS THAN BEST ESTIMATE."
00730GOTO 690
00740PRINT
00750U0=2*M0-L0
00760PRINT "THE MODEL IMPLIES YOUR PRIOR BELIEFS ABOUT THE GRAND MEAN"
00770PRINT "ARE SYMMETRIC ABOUT YOUR BEST ESTIMATE. THEREFORE BY THE"
00780:SYMMETRY YOUR UPPER BOUND IS ######.##.
00790PRINT USING 780,U0
00800GOSUB 830
00810IF T0=1 THEN 1020
00820GOTO 920
00830PRINT
00840PRINT "IF YOU ARE SATISFIED WITH THIS UPPER BOUND TYPE '1',ELSE '0'.";
00850GOSUB 9000
00860IF O1=1 THEN 900
00870IF O1=0 THEN 900
00880PRINT "REENTER. INPUT MUST BE 0 OR 1."
00890GOTO 850
00900T0=O1
00910RETURN
00920PRINT L$
00930PRINT "WHAT ARE YOUR BEST ESTIMATE AND LOWER BOUND.";
00940GOSUB 9050
00950IF O1>O2 THEN 990
00960PRINT "REENTER. BEST ESTIMATE MUST BE GREATER THAN LOWER BOUND."
00970GOTO 940
00980PRINT
00990L0=O2
01000M0=O1
01010GOTO 740
01020GOSUB 1060
01030E0=0
01040GOSUB 1120
01050GOTO 1380
01060PRINT L$
01070PRINT "FOR EACH INTERVAL THAT APPEARS BELOW DECIDE IF YOU FEEL IT IS"
01080PRINT "MORE LIKELY THAT THE GRAND MEAN IS INSIDE OR OUTSIDE OF IT."
01090PRINT
01100PRINT "RESPOND BY TYPING THE NUMBER OF THE APPROPRIATE OPTION."
01110RETURN
01120PRINT
01130PRINT "OUTSIDE=1 INSIDE=2 CAN'T DECIDE=3 "
01140PRINT
01150E1=1
01160I0=RND(0)
01170IF I0<.5 THEN 1200
01180I0=.65
01190GOTO 1210
01200I0=.8
01210I1=M0-I0*(M0-L0)
01220I2=M0+I0*(M0-L0)
01221PRINT"INTERVAL =";
01222SCRATCH#9
01223PRINT#9,I1
01224RESTORE#9
01225INPUT#9,Z$
01226Z$=RIGHT$(" "+Z$,9)
01227PRINTZ$;
01228PRINT" TO ";
01229SCRATCH#9
01230PRINT#9,I2
01231RESTORE#9
01232INPUT#9,Z$
01233Z$=RIGHT$(" "+Z$,9)
01234PRINTZ$;
01235PRINT" RESPONSE";
01240REM
01250GOSUB 9000
01260A0=O1
01270IF A0=1 THEN 1320
01280IF A0=2 THEN 1350
01290IF A0=3 THEN 1370
01300PRINT "REENTER. INPUT MUST BE NUMBER OF OPTION."
01310GOTO 1250
01320E0=I0
01330I0=.5*(E0+E1)
01340GOTO 1210
01350E1=I0
01360GOTO 1330
01370RETURN
01380GOSUB 1400
01390GOTO 1760
01400PRINT L$
01410PRINT "HERE ARE SOME PERCENTILES OF FOUR DISTRIBUTIONS WHICH ARE"
01420PRINT "CONSISTENT WITH WHAT YOU HAVE ALREADY TOLD US ABOUT YOUR"
01430PRINT "PRIOR BELIEFS CONCERNING THE GRAND MEAN."
01440PRINT
01450PRINT "THESE DISTRIBUTIONS HAVE THE SAME 25TH, 50TH AND 75TH"
01460PRINT "PERCENTILES BUT DIFFERENT EXTREME PERCENTILES."
01470PRINT
01480: 25TH=######.## 50TH=######.## 75TH=######.##
01490PRINT USING 1480,I1,M0,I2
01500PRINT
01510PRINT" 5TH 10TH 90TH 95TH"
01520K2=1
01530K0=3
01540J2=P(K2,1)
01550S(K2)=(I2-M0)/J2
01560IF K2=4 THEN 1590
01570K2=K2+1
01580GOTO 1540
01590REM
01600K0=3
01610K2=1
01620G=K0
01630P1=M0-P(K2,1)*S(K2)
01640P2=M0-P(K2,2)*S(K2)
01650P3=M0-P(K2,3)*S(K2)
01660P4=M0+P(K2,1)*S(K2)
01670P5=M0+P(K2,2)*S(K2)
01680P6=M0+P(K2,3)*S(K2)
01690:## ######.## ######.## ######.## ######.##
01700PRINT USING 1690,K2,P3,P2,P5,P6
01710IF K2=4 THEN 1740
01720K2=K2+1
01730GOTO 1620
01740PRINT
01750RETURN
01760PRINT "YOU CAN EITHER TENTATIVELY ACCEPT ONE OF THESE DISTRIBUTIONS"
01770PRINT "OR CHANGE YOUR BEST ESTIMATE AND BOUNDS AND REPEAT THE "
01780PRINT "PROCEDURE YOU JUST COMPLETED."
01790PRINT
01800PRINT "REPEAT=0 OR NUMBER OF DISTRIBUTION ";
01810GOSUB 9000
01820Z7=O1
01830IF O1=0 THEN 1870
01840IF O1 <= 4 THEN 1900
01850PRINT "REENTER. INPUT MUST 0 OR NUMBER OF DISTRIBUTION."
01860GOTO 1810
01870PRINT L$
01880S9=1
01890GOTO 530
01900IF O1<1 THEN 1850
01910V0=INT(O1)
01920S0=S(O1)
01930IF V0=4 THEN 1960
01940V1=V0*2+2
01950GOTO 1970
01960V1=12
01970L1=V1*S0*S0
01980L7=L0
01990E0=I1
02000PRINT L$
02010PRINT " PRIOR ON THE MEAN OF A RANDOMLY SELECTED GROUP"
02020PRINT
02030PRINT "YOU HAVE TENTATIVELY ACCEPTED A PRIOR DISTRIBUTION ON THE"
02040PRINT "AVERAGE OF THE GROUP MEANS OR THE GRAND MEAN. WE NOW WANT"
02050PRINT "YOU TO CONSIDER THE MEAN OF A RANDOMLY SELECTED GROUP."
02060PRINT
02070PRINT "YOU ARE AGAIN REMINDED OF THE IMPORTANCE OF KEEPING CLEARLY"
02080PRINT "IN MIND WHAT IT IS YOU ARE BEING ASKED ABOUT."
02090PRINT
02100PRINT "THE MODEL IMPLIES THAT YOUR BEST ESTIMATE OF THE MEAN OF"
02110PRINT "A RANDOMLY SELECTED GROUP IS THE SAME AS YOUR BEST ESTIMATE"
02120PRINT "OF THE GRAND MEAN."
02130PRINT
02140:YOUR BEST ESTIMATE OF THE GROUP MEAN IS ######.##.
02150PRINT USING 2140,M0
02160PRINT
02170PRINT "WHAT DO YOU FEEL IS A REASONABLE LOWER BOUND ON THE MEAN"
02180PRINT "OF THIS GROUP? AGAIN REASONABLE MAY BE TAKEN TO MEAN THAT"
02190PRINT "YOU FEEL THERE IS ONLY 1 CHANCE IN 20 THAT THE MEAN IS LESS"
02200PRINT "THAN THIS BOUND."
02210PRINT
02220PRINT "WHAT IS THE LOWER BOUND ON THE MEAN OF THIS GROUP.";
02230GOSUB 9000
02240IF O1<M0 THEN 2270
02250PRINT "REENTER. LOWER BOUND MUST BE LESS THAN BEST ESTIMATE."
02260GOTO 2230
02270IF O1<L7 THEN 2420
02280PRINT L$
02290PRINT USING 2460,M0,O1
02300PRINT
02310PRINT "THE MODEL IMPLIES THAT YOU ARE MORE UNCERTAIN ABOUT THE"
02320PRINT "MEAN OF A RANDOMLY SAMPLED GROUP THAN YOU ARE ABOUT THE"
02330PRINT "GRAND MEAN. ONLY PART OF YOUR UNCERTAINTY ABOUT THE GROUP"
02340PRINT "MEAN IS DUE TO YOUR UNCERTAINTY ABOUT THE GRAND MEAN."
02350PRINT
02360PRINT "THIS MEANS THAT YOUR LOWER BOUND ON THE MEAN OF THIS GROUP"
02370PRINT "MUST BE LESS THAN YOUR LOWER BOUND ON THE GRAND MEAN."
02380PRINT
02390:YOUR LOWER BOUND ON THE GRAND MEAN =#######.##
02400PRINT USING 2390,L7
02410GOTO 2210
02420L0=O1
02430PRINT
02440U0=2*M0-L0
02450PRINT L$
02460:BEST ESTIMATE =#######.## LOWER BOUND =#######.##
02470PRINT USING 2460,M0,L0
02480PRINT
02490:THE MODEL ALSO IMPLIES SYMMETRY IN YOUR BELIEFS ABOUT THE
02500PRINT"THIS MODEL ALSO IMPLIES SYMMETRY IN YOUR BELIEFS ABOUT THE"
02510:GROUP MEAN AND THEREFORE YOUR UPPER BOUND IS ######.##.
02520PRINT USING 2510,U0
02530PRINT
02540GOSUB 830
02550IF T0=1 THEN 2570
02560GOTO 2210
02570PRINT L$
02580PRINT "CONSIDER THE FOLLOWING INTERVALS AND DECIDE IF YOU THINK"
02590PRINT "IT IS MORE LIKELY THAT THE MEAN OF THE GROUP IS INSIDE OR"
02600PRINT "OUTSIDE EACH OF THE INTERVALS."
02610E0=(M0-E0)/(M0-L0)
02620GOSUB 1120
02630PRINT L$
02640PRINT "HERE ARE SOME PERCENTILES OF A DISTRIBUTION FITTED TO "
02650PRINT "BELIEFS ABOUT THE MEAN OF THE RANDOMLY SELECTED GROUP."
02660PRINT "THE DISTRIBUTION IS ALSO CONSISTENT WITH WHAT YOU HAVE"
02670PRINT "TOLD US ABOUT THE GRAND MEAN."
02680S1=(I2-M0)/P(V0,1)
02690Z7=3
02695Z8=3
02700P4=M0+P(V0,1)*S1
02710P1=M0-P(V0,1)*S1
02720P2=M0-P(V0,2)*S1
02730P3=M0-P(V0,3)*S1
02740P6=M0+P(V0,3)*S1
02750P5=M0+P(V0,2)*S1
02760: 5TH =######.##
02770PRINT USING 2760,P3
02780: 10TH =######.##
02790PRINT USING 2780,P2
02800: 25TH =######.##
02810PRINT USING 2800,P1
02820: 50TH =######.##
02830PRINT USING 2820,M0
02840: 75TH =######.##
02850PRINT USING 2840,P4
02860: 90TH =######.##
02870PRINT USING 2860,P5
02880: 95TH =######.##
02890PRINT USING 2880,P6
02900PRINT
02910 PRINT "THE MODE OF THE IMPLIED PRIOR DISTRIBUTION ON THE BETWEEN"
02920:GROUP STANDARD DEVIATION =########.##.
02930L3=S1*S1*V1
02940V3=V1
02950PRINT USING 2920,SQR(L3-L1)/SQR(V1+1)
02960PRINT
02970PRINT "YOU CAN EITHER TENTATIVELY ACCEPT THIS DISTRIBUTION AS "
02980PRINT "YOUR PRIOR DISTRIBUTION ON THE GROUP MEANS, OR REPEAT THE"
02990PRINT "ASSESSMENT PROCEDURE AT THE GRAND MEAN OR GROUP MEAN LEVEL."
03000PRINT
03010PRINT "REPEAT GROUP MEAN=-1 REPEAT GRAND MEAN=0 OR ACCEPT=1 ";
03020GOSUB 9000
03030A0=O1
03040IF A0=0 THEN 1870
03050IF A0=-1 THEN 3090
03060IF A0=1 THEN 3120
03070PRINT "REENTER. INPUT MUST BE NUMBER OF OPTION OR DISTRIBUTION."
03080GOTO 3020
03090PRINT L$
03100GOTO 2090
03110PRINT L$
03120PRINT L$
03130PRINT " PRIOR ON A RANDOMLY SELECTED OBSERVATION FROM A GROUP"
03140PRINT
03150PRINT "WE NOW WANT TO ASK YOU ABOUT YOUR BELIEFS CONCERNING THE"
03160PRINT "VARIABILITY WITHIN A GROUP. ARE THE OBSERVATIONS IN A"
03170PRINT "GROUP MUCH THE SAME OR ARE THEY QUITE DIFFERENT?"
03180PRINT
03190PRINT "SUPPOSE A GROUP IS SELECTED AT RANDOM AND YOU ARE TOLD THAT"
03200:THE MEAN OF THE GROUP IS ######.##.
03210PRINT USING 3200,M0
03230PRINT
03240PRINT "WHAT DO YOU FEEL IS A REASONABLE LOWER BOUND FOR THE VALUE OF"
03250PRINT "AN OBSERVATION SELECTED AT RANDOM FROM THIS GROUP.";
03260GOSUB 9000
03270IF O1<M0 THEN 3300
03280PRINT "REENTER. LOWER MUST BE LESS THAN BEST ESTIMATE."
03290GOTO 3260
03300L0=O1
03310PRINT
03320U0=2*M0-L0
03330U0=O1
03340PRINT L$
03343E0=0
03350PRINT "CONSIDER THE FOLLOWING INTERVALS AND DECIDE IF YOU THINK IT"
03360PRINT "MORE LIKEY THAT AN OBSERVATION SELECTED AT RANDOM FROM THIS"
03370PRINT "GROUP WILL BE INSIDE OR OUTSIDE THE INTERVAL."
03380GOSUB 1120
03390PRINT L$
03400PRINT "HERE ARE SOME PERCENTILES OF FOUR DISTRIBUTIONS WHICH ARE"
03410PRINT "CONSISTENT WITH WHAT YOU HAVE TOLD US ABOUT YOUR PRIOR"
03420PRINT "BELIEFS ABOUT A RANDOMLY SAMPLED OBSERVATION FROM THE GROUP."
03430GOSUB 1440
03440PRINT "YOU CAN EITHER TENTATIVELY ACCEPT ONE OF THESE DISTRIBUTIONS"
03450PRINT "AS YOUR PRIOR DISTRIBUTION OR REPEAT THE ASSESSMENT PROCEDURE"
03460PRINT "AT THE GRAND MEAN, GROUP MEAN OR WITHIN GROUP LEVEL."
03480PRINT
03490PRINT "GRAND MEAN=-2 GROUP MEAN=-1 WITHIN GROUP=0 OR DISTRIBUTION";
03500GOSUB 9000
03510Z8=O1
03520IF O1=-2 THEN 1870
03530IF O1=-1 THEN 3090
03540IF O1=0 THEN 3580
03550IF O1 >= 1 THEN 3600
03560PRINT "REENTER. INPUT MUST BE NUMBER OF OPTION OR DISTRIBUTION."
03570GOTO 3500
03580PRINT L$
03590GOTO 3140
03600IF O1>4 THEN 3560
03610O1=INT(O1)
03620 ONO1 GOTO 3630,3630,3630,3650
03630V2=O1*2+2
03640GOTO 3660
03650V2=12
03660L2=V2*S(O1)*S(O1)
03670PRINT L$
03680PRINT "HERE ARE SOME CHARACTERISTICS OF THE PRIOR DISTRIBUTIONS"
03690PRINT "FITTED TO YOUR BELIEFS ABOUT "
03700PRINT " 1. GRAND MEAN"
03710PRINT " 2. MEAN OF A RANDOMLY SELECTED GROUP"
03720PRINT " 3. A RANDOMLY SELECTED OBSERVATION FROM A GROUP WITH"
03730: MEAN =#######.##
03740PRINT USING 3730,M0
03750PRINT
03760PRINT "T DISTRIBUTIONS GRAND MEAN GROUP MEAN OBSERVATION"
03762PRINT "--------------------------------------------------------"
03770:DEGREES OF FREEDOM#####.## #######.## #######.##
03780PRINT USING 3770,V1,V1,V2
03790:MEAN #######.## #######.## #######.##
03800PRINT USING 3790,M0,M0,M0
03810:ST. DEVIATION ########.## #######.## #######.##
03820PRINT USING 3810,SQR(L1/(V1-2)),SQR(L3/(V1-2)),SQR(L2/(V2-2))
03830FOR I=3 TO 1 STEP 0-1
03840P1=M0-P(Z7,I)*SQR(L1/V1)
03850P2=M0-P(Z7,I)*SQR(L3/V1)
03860P3=M0-P(Z8,I)*SQR(L2/V2)
03870:##TH #######.## #######.## #######.##
03880PRINT USING 3870,Z(4-I),P1,P2,P3
03890NEXT I
03900FOR I=1 TO 3
03910P1=M0+P(Z7,I)*SQR(L1/V1)
03920P2=M0+P(Z7,I)*SQR(L3/V1)
03930P3=M0+P(Z8,I)*SQR(L2/V2)
03940PRINT USING 3870,100-Z(4-I),P1,P2,P3
03950NEXT I
03960PRINT
03970PRINT "IF YOU WANT TO DO THE POSTERIOR ANALYSIS TYPE '1', ELSE '0'.";
03980GOSUB 9000
03990IF O1=1 THEN 4120
04000IF O1=0 THEN 4010
04010PRINT L$
04020PRINT "IF YOU LATER DECIDE TO DO A POSTERIOR ANALYSIS AND WANT"
04030PRINT "TO USE THE PRIOR DISTRIBUTIONS YOU JUST FITTED YOU WILL"
04040PRINT "NEED TO INPUT THE FOLLOWING INFORMATION."
04041PRINT
04050:DEGREES OF FREEDOM FOR GRAND MEAN =#######.##
04060PRINT USING 4050,V1
04070:MEAN OF PRIOR ON GRAND MEAN =#######.##
04080PRINT USING 4070,M0
04082:ST. DEVIATION OF PRIOR ON GRAND MEAN =######.###
04083PRINT USING 4082,SQR(L1/(V1-2))
04084:ST. DEVIATION OF PRIOR ON GROUP MEAN =#######.##
04085PRINT USING 4084,SQR(L3/(V1-2))
04086:DEGREES OF FREEDOM OF PRIOR ON OBSERVATION =#######.##
04087PRINT USING 4086,V2
04088:ST. DEVIATION OF PRIOR ON OBSERVATION =######.###
04089PRINT USING 4088,SQR(L2/(V2-2))
04090PRINT "WHEN YOU ARE READY TO CONTINUE TYPE '1'.";
04100GOSUB 9000
04110CHAIN "RSTRT"
04112REM BETWEEN DF,WEIGHT ON GRAND MEAN,SCALE FOR BETWEEEN,DF WITHIN,SCALE
04113REM GRAND MEAN
04120SCRATCH#2
04121 PRINT # 2,V1,L3/L1-1,SQR(L3-L1),V2,SQR(L2),M0
04130CHAIN "CMOD77"
09000REM--SUBROUTINE THAT DETERMINES IF RESTART HAS BEEN REQUESTED.
09005INPUT O1
09015IF O1=-9999 THEN 9025
09020RETURN
09025CHAIN "RSTRT"
09035REM*************END ROUTINE
09050REM--SUBROUTINE THAT DETERMINES IF RESTART HAS BEEN REQUESTED. 2 INPUTS
09055INPUT O1,O2
09065IF O1=-9999 THEN 9080
09070IF O2=-9999 THEN 9080
09075RETURN
09080CHAIN "RSTRT"
09090REM*************END ROUTINE
09999END