10 CLS
20 PRINT "              BETA AND ALPHA"
30 PRINT
40 PRINT"GIVEN DATA WITH REGARDS TO PRICES AND DIVIDENDS OVER A
50 PRINT"PERIOD OF TIME FOR A GIVEN STOCK AND AN INVESTOR SELECTED 
60 PRINT"MARKET INDEX THIS PROGRAM WILL COMPUTE THE ALPHA AND BETA
70 PRINT"VALUES FOR A STOCK ALONG WITH ITS EXPECTED RETURN, VARIANCE
80 PRINT"OF RETURN, AND STANDARD DEVIATION OF RETURN."
90 PRINT:INPUT"PRESS ENTER TO BEGIN";Z9
1000 CLS
1010 INPUT"HOW MANY PERIODS OF DATA ARE AVAILABLE ";N
1013 Z=N+2:DIM PP(Z),DI(Z),YI(Z),P(Z),D(Z),Y(Z)
1015 PRINT
1020 FOR I=1 TO N
1030 PRINT"INPUT MARKET INDEX PRICE,DIVIDEND FOR PERIOD";I;:INPUT PP(I),DI(I)
1040 NEXT I
1045 PRINT
1050 FOR I=1 TO N
1060 PRINT"INPUT STOCK PRICE,DIVIDEND FOR  PERIOD  ";I;:INPUT P(I),D(I)
1070 NEXT I
1080 FOR I=1 TO N-1
1090 YI(I)=(PP(I+1)-PP(I)+DI(I+1))/PP(I)
1095 Y(I)=(P(I+1)-P(I)+D(I+1))/P(I)
1099 NEXT I
1100 REM COMPUTATION SUBROUTINE
1110 X1=0:X2=0:Y1=0:Y2=0:XY=0
1115 N2=N:N=N-1
1120 FOR I=1 TO N
1130 X1=X1+YI(I):X2=X2+YI(I)[2
1140 Y1=Y1+Y(I):Y2=Y2+Y(I)[2
1150 XY=XY+YI(I)*Y(I)
1160 NEXT I
1170 SX=X2-X1[2/N: SY=Y2-Y1[2/N
1180 SPROD=XY-X1*Y1/N
1190 A=SPROD/SX:REM SLOPE OF REGRESSION LINE
1200 B=Y1/N-A*X1/N:REM Y INTERCEPT OF REGRESSION LINE
1210 SE=SY-A*SPROD:REM ERROR SUM OF SQUARES
1220 R=SPROD/SQR(SX*SY)
1300 CLS
1302 PRINT"THE NUMBER OF OBSERVATIONS = ";N2
1305 F$(2)="THE ESTIMATED EQUATION IS Y = #####.### X  + #####.###"
1310 PRINT USING F$(2);A,B
1315 F$(3)="THE CORRELATION COEFFICIENT = #.####"
1317 F$(4)="THE COEFF. OF DETERMINATION = #.####"
1320 PRINT:PRINT USING F$(3);R
1325 PRINT USING F$(4);R[2
1330 F$(5)="THE STANDARD ERROR OF ESTIMATE = ####.###"
1335 PRINT USING F$(5);SQR(SE/(N-2))
1345 PRINT"ALPHA         = ";B
1350 PRINT"BETA          = ";A
1360 PRINT"EXPECTED RETURN    = ";B+A*X1/N
1365 VARI=SX/(N-1)
1370 SDI=SQR(VARI)
1380 S2=(Y2-B*Y1-A*XY)/(N-2)
1390 V=A[2*VARI + S2
1400 PRINT"VARIANCE OF RETURN= ";V
1410 PRINT"STAN DEV OF RETURN= ";SQR(V)
1430 PRINT"FOR INDEX EXPECTED RETURN =";X1/N;"   VAR OF RETURN =";SX/(N-1)
1440 PRINT"   SD OF RETURN = ";SQR(SX/(N-1))
1500 PRINT
1510 PRINT"PRESS ENTER TO SUBMIT DATA FOR SAME TIME PERIOD BUT
1520 INPUT"DIFFERENT STOCK,I.E. MARKET DATA STAYS THE SAME";Z9
1525 IF Z9 = 0 THEN END
1530 CLS:N=N2:GOTO 1050
