Trailing-Edge
-
PDP-10 Archives
-
decus_20tap4_198111
-
decus/20-0113/cmodp.bas
There are 2 other files named cmodp.bas in the archive. Click here to see a list.
00020REM******************************************************************
00030REM CMODP CMODP CMODP CMODP CMODP CMODP
00040REM
00050REM PIECEWISE EXPECTED UTILITY
00060REM
00070REM*****************************************************************
00080FILES RFILE1,RFILE2,RFILE3
00120RESTORE#1
00121 INPUT# 1,I1,I2,I3
00130SCRATCH#1
00131 PRINT # 1,25,I2,I3
00140DIM M(9),U(9),P(3)
00145RESTORE#2
00150FOR I=1 TO 9
00161INPUT#2,M(I)
00170NEXT I
00180FOR I=1 TO 9
00185 INPUT#2,U(I)
00200NEXT I
00220DIM V(1)
00222RESTORE #3
00230 INPUT #3,V(1)
00270IF V(1)=1 THEN 2080
00280P(3)=0
00290PRINT L$
00300PRINT " PIECEWISE EXPECTED UTILITY"
00310PRINT
00320PRINT "THIS MODULE COMPUTES THE EXPECTED UTILITY USING THE LEAST"
00330PRINT "SQUARES UTILITIES OR ANY SPECIFIED UTILITIES AND THE"
00340PRINT "DISTRIBUTION YOU CHOOSE."
00350PRINT
00360IF U(9) <> 0 THEN 710
00370PRINT "ENTER THE NINE POINTS YOU USED IN ASSESSING YOUR UTILITY"
00380PRINT "FUNCTION AND THE CORRESPONDING UTILITIES. ENTER THE POINT"
00390PRINT "FOLLOWED BY A COMMA AND THEN THE UTILITY."
00400PRINT
00410FOR K5=1 TO 9
00420REM
00430PRINT" POINT ";K5;
00440GOSUB 9050
00450IF K5=1 THEN 480
00460IF O1 <= M(K5-1) THEN 860
00470IF O2 <= U(K5-1) THEN 890
00480M(K5)=O1
00490U(K5)=O2
00500IF U(1) <> 0 THEN 920
00510NEXT K5
00520IF U(9) <> 1 THEN 950
00530PRINT L$
00540PRINT "HERE IS WHAT YOU ENTERED."
00550PRINT " VALUE UTILITY"
00560FOR K5=1 TO 9
00570:POINT ## ####.## ##.##
00580PRINT USING 570,K5,M(K5),U(K5)
00600NEXT K5
00610PRINT
00620PRINT "IF YOU WANT TO REENTER TYPE '1', ELSE '0'.";
00630GOSUB 9000
00640IF O1=0 THEN 700
00650IF O1 <> 1 THEN 680
00660PRINT L$
00670GOTO 400
00680PRINT "REENTER. MUST BE 0 OR 1."
00690GOTO 630
00700PRINT L$
00710PRINT "TYPE THE NUMBER OF THE KIND OF PROBABILITY DISTRIBUTION YOU "
00720PRINT "WANT TO USE."
00730PRINT " 1. BETA"
00740PRINT " 2. NORMAL"
00750PRINT " 3. STUDENT'S T "
00760PRINT " 4. INVERSE CHI"
00770PRINT " 5. EXIT MODULE"
00780GOSUB 9000
00790IF O1=5 THEN 2070
00800IF O1=1 THEN 980
00810IF O1=2 THEN 1420
00820IF O1=3 THEN 1830
00830IF O1=4 THEN 1580
00840PRINT "REENTER. INPUT MUST BE 1,2,3,4 OR 5."
00850GOTO 780
00860PRINT "REENTER. YOUR POINT VALUES ARE NOT MONOTONIC INCREASING."
00870GOTO 400
00880PRINT
00890PRINT
00900PRINT "REENTER. YOUR UTILITIES ARE NOT MONOTONIC UTILITIES."
00910GOTO 400
00920PRINT
00930PRINT "REENTER. UTILITY OF FIRST POINT VALUE MUST BE 0."
00940GOTO 400
00950PRINT
00960PRINT "REENTER. UTILITY OF LAST POINT VALUE MUST BE 1."
00970GOTO 400
00980PRINT L$
00990PRINT "BETA DISTRIBUTION"
01000PRINT
01010IF M(1)<0 THEN 1030
01020IF M(9) <= 1 THEN 1200
01030PRINT
01040PRINT "BETA DISTRIBUTIONS ARE ONLY DEFINED FOR VALUES FROM 0 TO 1."
01050PRINT "SOME OF YOUR POINTS HOWEVER ARE NOT IN THIS INTERVAL."
01060PRINT
01070PRINT "IF YOU WANT TO RESPECIFY THE POINTS AND UTILITIES TYPE '1'."
01080PRINT "IF YOU WANT TO RESPECIFY THE TYPE OF DISTRIBUTION TYPE '2'."
01090PRINT "IF YOU WANT TO EXIT MODULE TYPE '0'."
01100GOSUB 9000
01110IF O1=1 THEN 1160
01120IF O1=2 THEN 700
01130IF O1=0 THEN 2070
01140PRINT "REENTER. INPUT MUST BE 0,1 OR 2."
01150GOTO 1070
01160PRINT L$
01170PRINT "INPUT THE POINT VALUE AND THE UTILITY OF THE POINT SEPARATED"
01180PRINT "BY A COMMA."
01190GOTO 400
01200PRINT
01210PRINT "INPUT PARAMETER A";
01220GOSUB 9000
01230IF O1>1.15 THEN 1260
01240PRINT "REENTER. PARAMETER MUST BE GREATER THAN 1.15."
01250GOTO 1220
01260P(1)=O1
01270PRINT
01280PRINT "INPUT PARAMETER B";
01290GOSUB 9000
01300IF O1>1.15 THEN 1330
01310PRINT "REENTER. PARAMETER MUST BE GREATER THAN 1.15."
01320GOTO 1290
01330P(2)=O1
01340SCRATCH#3
01350FOR I=1 TO 9
01361 PRINT # 3,M(I)
01370NEXT I
01380FOR I=1 TO 9
01390PRINT#3,U(I)
01400NEXT I
01402FOR I=1 TO 3
01404PRINT#3,P(I)
01406NEXT I
01410CHAIN "CMODB"
01420REM
01430PRINT L$
01440PRINT "NORMAL DISTRIBUTION"
01450PRINT
01460PRINT "INPUT THE MEAN ";
01470GOSUB 9000
01480P(1)=O1
01490PRINT
01500PRINT "INPUT THE STANDARD DEVIATION";
01510GOSUB 9000
01520IF O1>0 THEN 1550
01530PRINT "REENTER. STANDARD DEVIATION MUST BE POSITIVE."
01540GOTO 1510
01550P(2)=O1
01551SCRATCH#3
01552FOR I=1 TO 9
01553PRINT#3,M(I)
01554NEXTI
01555FOR I=1 TO 9
01556PRINT#3,U(I)
01557NEXTI
01558FOR I=1 TO 3
01559PRINT#3,P(I)
01560NEXTI
01570CHAIN "CMODE"
01580REM INVERSE CHI
01590PRINT L$
01600PRINT "INVERSE CHI DISTRIBUTION"
01610PRINT
01620IF M(1) >= 0 THEN 1660
01630PRINT "INVERSE CHI DISTRIBUTIONS ARE NOT DEFINED FOR NEGATIVE"
01640PRINT "VALUES."
01650GOTO 1070
01660PRINT
01670PRINT "INPUT THE DEGREES OF FREEDOM";
01680GOSUB 9000
01690IF O1>2 THEN 1720
01700PRINT "REENTER. THE DEGREES OF FREEDOM MUST BE GREATER THAN 2."
01710GOTO 1680
01720P(1)=O1
01730PRINT
01740PRINT "INPUT THE SCALE PARAMETER.";
01750GOSUB 9000
01760IF O1>0 THEN 1790
01770PRINT "REENTER. SCALE PARAMETER MUST BE POSITIVE."
01780GOTO 1750
01790P(2)=O1
01800P(3)=0
01801SCRATCH#3
01802FOR I=1 TO 9
01803PRINT#3,M(I)
01804NEXT I
01805FOR I=1 TO 9
01806PRINT#3,U(I)
01807NEXT I
01808FOR I=1 TO 3
01809PRINT#3,P(I)
01810NEXT I
01820CHAIN "CMODD"
01830REM
01840PRINT L$
01850PRINT "STUDENT'S T DISTRIBUTION"
01860PRINT
01870PRINT "INPUT THE DEGREES OF FREEDOM";
01880GOSUB 9000
01890IF O1 >= 3 THEN 1920
01900PRINT "REENTER. DEGREES OF FREEDOM MUST BE AT LEAST 3."
01910GOTO 1880
01920P(1)=O1
01930PRINT
01940PRINT "INPUT THE MEAN";
01950GOSUB 9000
01960P(2)=O1
01970PRINT
01980PRINT "INPUT THE SCALE PARAMETER";
01990GOSUB 9000
02000IF O1>0 THEN 2030
02010PRINT "REENTER. SCALE PARAMETER MUST BE POSITIVE."
02020GOTO 1990
02030P(3)=O1
02031SCRATCH#3
02032FOR I=1 TO 9
02033PRINT#3,M(I)
02034NEXT I
02035FOR I=1 TO 9
02036PRINT#3,U(I)
02037NEXT I
02038FOR I=1 TO 3
02039PRINT#3,P(I)
02040NEXT I
02050CHAIN "CMODC"
02060REM TTTT
02070CHAIN "RSTRT"
02080PRINT
02081RESTORE#3
02082INPUT#3,V(1)
02083FOR I=1 TO 9
02084INPUT#3,M(I)
02085NEXT I
02086FOR I=1 TO 9
02087INPUT#3,U(I)
02088NEXT I
02089FOR I=1 TO 3
02090INPUT#3,P(I)
02091NEXT I
02100PRINT L$
02110PRINT "TYPE THE NUMBER OF THE OPTION YOU WANT."
02120PRINT " 1. SPECIFY A DIFFERENT UTILITY FUNCTION"
02130PRINT " 2. TAKE EXPECTATION WITH RESPECT TO ANOTHER DISTRIBUTION"
02140PRINT " 3. EXIT MODULE"
02150GOSUB 9000
02160IF O1=3 THEN 2220
02170IF O1=2 THEN 700
02180PRINT
02190IF O1=1 THEN 370
02200PRINT "REENTER. INPUT MUST BE 1, 2, OR 3."
02210GOTO 2150
02220CHAIN "RSTRT"
02230REM********************************************************************
02240REM
02250REM APPPENDED GOSUBS FOLLOW
02260REM
09000REM--SUBROUTINE THAT DETERMINES IF RESTART HAS BEEN REQUESTED.
09010INPUT O1
09020IF O1=-9999 THEN 9040
09030RETURN
09040CHAIN "RSTRT"
09050REM--SUBROUTINE THAT DETERMINES IF RESTART HAS BEEN REQUESTED. 2 INPUTS
09060INPUT O1,O2
09070IF O1=-9999 THEN 9100
09080IF O2=-9999 THEN 9100
09090RETURN
09100CHAIN "RSTRT"
09110REM*************END ROUTINE
09999END