Trailing-Edge
-
PDP-10 Archives
-
decuslib20-01
-
decus/20-0020/return.tuk
There are 2 other files named return.tuk in the archive. Click here to see a list.
1' NAME--RETURN
2' DESCRIPTION--COMPUTES MATRIX OF RATES OF RETURN ON INVESTMENT
3' SOURCE--REVISED 12/26/67 BY J. WESTFALL
4' INSTRUCTIONS--TO CHANGE THIS PROGRAM TO READ IN DATA INSTEAD
5' OF USING THE INPUT FORMAT, SIMPLY DELETE THE PRINT STATEMENTS
6' UP TO LINE 100, CHANGE THE INPUT STATEMENTS TO READ STATEMENTS
7' AND THEN ENTER THE DATA BEGINNING IN LINE 1100. REMEMBER THE
8' NUMBER OF YEARS (N) AND THE FIRST YEAR (Y1) MUST BE ENTERED
9' BEFORE THE PRICE AND DIVIDEND DATA.
10' THIS PROGRAM WAS WRITTEN FOR STUDENT USE AT AMOS TUCK SCHOOL
11' OF HANOVER,N.H., WHICH DOES NOT ASSUME RESPONSIBILITY FOR
12' ITS ACCURACY.
13'
14' * * * * * * * * * * * MAIN PROGRAM * * * * * * * * * * * * *
15'
19 PRINT "THIS PROGRAM COMPUTES A MATRIX OF RETURNS FOR AN INVESTMENT IN"
20 PRINT"A STOCK. IT THEN COMPUTES AN AVERAGE RETURN FOR A PURCHASE AT"
25 PRINT"THE BEGINNING OF A YEAR, SELLING AT EACH OF THE FOLLOWING YEAR'S"
30 PRINT"ENDS, AND COMPUTES AN AVERAGE RETURN FOR ALL POSSIBLE HOLDING"
31 PRINT"PERIODS. IT ALSO COMPUTES AN AVERAGE RETURN, STANDARD DEVIA-"
32 PRINT"TION AND COEFFICIENT OF VARIATION FOR DIFFERENT LENGTH HOLDING"
35 PRINT"PERIODS. (IF YOU WISH TO ENTER YOUR DATA IN DATA STATEMENTS,"
40 PRINT"THEN 'LIST' THIS PROGRAM FOR THE INSTRUCTIONS WHICH APPEAR AT"
45 PRINT"THE BEGINNING IN REMARK STATEMENTS.)"
47 PRINT
50 PRINT"FOR HOW MANY YEARS DO YOU WISH TO ENTER PRICE AND DIVIDEND"
52 PRINT"DATA, REMEMBERING THE NEED FOR A BASE YEAR (MAXIMUM NUMBER"
54 PRINT"OF YEARS IS 25)";
56 INPUT N
58 PRINT
60 PRINT"WHAT IS THE FIRST YEAR FOR WHICH YOU WISH TO ENTER DATA";
62 INPUT Y1
64 PRINT
66 PRINT"ENTER THE DIVIDEND PER SHARE AND THE CLOSING STOCK PRICE,"
68 PRINT"SEPERATED BY A COMMA, FOR EACH OF THE FOLLOWING YEARS."
70 PRINT
72 PRINT TAB(12);"DPS, CSP"
74 PRINT
76 FOR I=1 TO N
78 PRINT"YEAR";Y1+(I-1);
80 INPUT D(I),P(I)
82 NEXT I
90 PRINT
100 PRINT"----------------------------------------------------------------------"
110 DIM D(25),P(25),W(25,25)
120 FOR I = 1 TO (N-1)
130 FOR J = (I+1) TO N
140 LET B = 0
150 FOR C = 1 TO 5
160 LET Q = .1^C
170 LET B = B + Q
180 LET E = 0
190 FOR F = (I+1) TO J
200 LET E = (D(F)*(1/((1+B)^(F-I)))) + E
210 NEXT F
220 LET E = E + P(J)*(1/((1+B)^(J-I)))
230 IF E-P(I)>0 THEN 170
240 LET B = B-Q
250 NEXT C
260 IF B = 0 THEN 280
270 GO TO 300
280 LET B = -.8
290 GO TO 150
300 LET W(I,J) =B
310 NEXT J
320 NEXT I
330 PRINT
340 PRINT
350 PRINT
360 PRINT
370 PRINT" RETURNS ON INVESTMENTS"
380 PRINT" ----------------------"
390 PRINT
400 PRINT
410 FOR K=1 TO (N-1) STEP4
420 IF N-1-K<4 THEN590
430 PRINT" TO",Y1+K,Y1+(K+1),Y1+(K+2),Y1+(K+3)
440 PRINT"FROM"
450 FOR I=1 TO K
460 PRINT Y1+(I-1),
470 FOR J=(K+1) TO (K+4)
480 PRINT W(I,J),
490 NEXT J
500 NEXT I
510 PRINT Y1+K," ",W(K+1,K+2),W(K+1,K+3),W(K+1,K+4)
520 PRINT Y1+K+1," "," ",W(K+2,K+3),W(K+2,K+4)
530 PRINT Y1+K+2," "," "," ",W(K+3,K+4)
540 PRINT
550 PRINT
560 PRINT
570 NEXT K
580 GO TO 840
590 PRINT" TO",
600 FOR I=K TO (N-1)
610 PRINT Y1+I,
620 NEXT I
630 LET Q=4-(N-K)
640 GOSUB 800
650 PRINT"FROM"
660 FOR I=1 TO N-1
670 PRINT Y1+(I-1),
680 IF I<=(N-(N-K)) THEN 730
690 LET Q=I-K
700 GOSUB 800
710 LET J=K+1+Q
720 GO TO 740
730 FOR J=K+1 TO N
740 PRINT W(I,J),
750 NEXT J
760 LET Q=4-(N-K)
770 GOSUB 800
780 NEXT I
790 GO TO 840
800 FOR H=1 TO Q
810 PRINT " ",
820 NEXT H
830 RETURN
840 PRINT
850 PRINT
860 PRINT
870 LET X=0
880 LET Y=0
890 LET V=0
900 FOR I=1 TO (N-1)
910 FOR J=(I+1) TO N
920 LET X=W(I,J)+X
930 LET Y=W(I,J)+Y
940 NEXT J
950 PRINT"AVERAGE RETURN FROM";Y1+(I-1);"=";X/(N-I)
960 LET V=(N-I)+V
970 PRINT
980 LET X=0
990 NEXT I
1000 PRINT
1010 PRINT" AVERAGE RETURN FOR ALL"
1020 PRINT"POSSIBLE HOLDING PERIODS =";Y/V
1030 PRINT
1031 PRINT
1033 PRINT" ----------------------------"
1034 PRINT
1035 PRINT
1036 PRINT TAB(35);"AVERAGE";TAB(47);"STANDARD";TAB(61);"COEFF."
1037 PRINT TAB(36);"RETURN";TAB(47);"DEVIATION";TAB(60);"VARIATION"
1038 PRINT
1039 LET V3=0
1040 LET N2 = 0
1041 LET X2 = 0
1042 LET Y2 = 0
1043 LET V2 = 0
1044 FOR I = 1 TO (N-1)
1045 FOR J = 1 TO N
1046 IF J + I > N THEN 1050
1047 LET X2 = W(J,J+I) + X2
1048 LET V2 = W(J,J+I) + V2
1049 NEXT J
1050 LET X2 = X2/(J-1)
1051 FOR J = 1 TO N
1052 IF J + I > N THEN 1056
1053 LET Y2 = (W(J,J+I)-X2)^2+Y2
1054 LET V3 = (W(J,J+I))^2+V3
1055 NEXT J
1056 LET Y2 = SQR(Y2/(J-1))
1057 PRINT "FOR ALL"I;"YEAR HOLDING PERIODS:"TAB(35);X2;TAB(47);Y2;
1058 PRINT TAB(60);Y2/X2
1059 PRINT
1060 LET X2 = 0
1061 LET Y2=C3=0
1062 NEXT I
1063 IF V-1 =0 THEN 1065
1064 LET C3=SQR((V*V3-V2*V2)/V/(V-1))
1065 PRINT "FOR ALL POSSIBLE HOLDING PERIODS:"TAB(35);V2/V;TAB(47);C3;
1066 PRINT TAB(60);C3/(V2/V)
1067 PRINT
1068 PRINT
1069 PRINT
1070 PRINT"--------------------------------------------------------------------"
1071 END