Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50110/macro.tuk
There are 2 other files named macro.tuk in the archive. Click here to see a list.
1' NAME--MACRO
2'
3' DESCRIPTION--MULTIPLE REGRESSIONS OF NAT'L INCOME & PRODUCT ACCTS
4'
5' SOURCE--REVISED 6/26/69 BY D. DOWNES
6'
7' INSTRUCTIONS FOR THE USE OF THIS PROGRAM ARE CONTAINED IN THE
8' LIBRARY PROGRAM "INSTRUCT***"
9'
10'THIS PROGRAM WAS WRITTEN FOR STUDENT USE AT AMOS TUCK SCHOOL OF
11' HANOVER, N.H. WHICH DOES NOT ASSUME RESPONSIBILITY FOR ITS
12' ACCURACY.
13'
14' * * * * * * * * * * MAIN PROGRAM * * * * * * 
15'
20 DIM X(28,28),D(21,28),T(28),B(28),R(28,28),C(28,28),F(28,21)
21 DIM A(10,10),Y(10),M(10),S(10),U(10,10),Q(21),E(10),Z(28)
23 LET B5=H=X9=L6=L7=L8=L9=0
24 LET N=21
25 PRINT" HOW MANY REGRESSIONS DO YOU WANT TO RUN";
26 INPUT G
27 GOSUB 850
29 IF H>0 THEN 32
30 PRINT"***REGRESSION 1"
32 LET N8=N7-1947
33 LET N=21
34 LET V=28
35 MAT READ F(V,N)
36 MAT D=TRN(F)
38 FOR I=1 TO N
39   LET D(I,0)=1
40 NEXT I
42 PRINT" DO YOU WANT TO TRANSFORM THE DATA";
44 INPUT A5$
45 IF A5$="NO" THEN 58
48 IF H>0 THEN 55
50 PRINT" TO TRANSFORM DATA, SEE INSTRUCTIONS IN'INSTRUCT***'"
55 PRINT" TYPE IN THE SWITCHES";
56 INPUT L6,L7,L8,L9
58 LET H=H+1
60 GOSUB 900
62 GOSUB 890
65 PRINT" HOW MANY INDEPENDENT VARIABLES DO YOU WANT";
67 INPUT K
70 PRINT" WHAT ARE THEY"
71 FOR J=1 TO K
72   INPUT E(J)
73 NEXT J
75 PRINT" WHAT IS THE INDEX OF THE DEPENDENT VARIABLE";
77 LET M=K+1
78 INPUT E(M)
80 GOSUB 1800
82 PRINT" DO YOU WANT THE RESIDUALS PRINTED";
83 INPUT A5$
85 IF A5$="YES" THEN 90
87 LET P2=0
88 GO TO 95
90 LET P2=1
95 LET P1=0
148 PRINT
149 PRINT
150 PRINT "**REGRESSION NUMBER"H":DEPENDENT VARIABLE IS"E(M)
155 PRINT
165 FOR I=0 TO V
170  FOR J=0 TO V
175     LET X=0
180 FOR L= N8 TO N9
185       LET X=X+D(L,I)*D(L,J)
190 NEXT L
195    LET X(I,J)=X
200      LET C(I,J)=X
205   NEXT J
210  LET T(I)=X(0,I)/X(0,0)
215 LET B(I)=0
220 IF I=0 THEN 230
225 LET B(I)=SQR(X(I,I)/(N-1)-X(0,I)*X(0,I)/(N*(N-1)))
230 NEXT I
235 PRINT "INDEX", "MEANS", "STANDARD DEVIATIONS"
240 FOR I=1 TO M
245 LET M(I)=T(E(I))
250 LET S(I)=B(E(I))
255 PRINT E(I), M(I), S(I)
260 NEXT I
265 PRINT
270 PRINT
275 PRINT "CORRELATION COEFFICIENTS"
285 FOR I=1 TO V
290  FOR J=1 TO V
295   LET R(I,J)=(N*X(I,J)-X(0,I)*X(0,J))/(N*(N-1)*B(I)*B(J))
300  NEXT J
305 NEXT I
310 FOR I=1 TO M
315   FOR J=1 TO M
320     LET U(I,J)=R(E(I),E(J))
325   PRINT U(I,J),
330   NEXT J
335 PRINT
340 PRINT
345 NEXT I
350 PRINT
355 LET E(0)=0
360 FOR I=0 TO K
365  LET Y(I)=C(E(I),E(M))
370   FOR J=0 TO K
375    LET X(I,J)=C(E(I),E(J))
380   NEXT J
385 NEXT I
390 FOR I=0 TO K
395  FOR J=0 TO K
400   IF I<>J THEN 415
405   LET A(I,J)=1
410   GO TO 420
415   LET A(I,J)=0
420  NEXT J
425 NEXT I
430 FOR I=0 TO K
435 IF X(I,I)<1E-6 THEN 805
440  LET Y(I)=Y(I)/X(I,I)
445   FOR J=0 TO K
450    LET A(I,J)=A(I,J)/X(I,I)
455    IF J=I THEN 465
460    LET X(I,J)=X(I,J)/X(I,I)
465   NEXT J
470  LET X(I,I)=1
475   FOR L=0 TO K
480    IF L=I THEN 520
485    LET Y(L)=Y(L)-X(L,I)*Y(I)
490     FOR J=0 TO K
495      LET A(L,J)=A(L,J)-X(L,I)*A(I,J)
500      IF J=I THEN 510
505      LET X(L,J)=X(L,J)-X(L,I)*X(I,J)
510     NEXT J
515    LET X(L,I)=0
520   NEXT L
525 NEXT I
530 LET S6=C(E(M),E(M))
535 FOR I=0 TO K
540   LET S6=S6-Y(I)*C(E(I),E(M))
545 NEXT I
550 LET S7=S6/(N-M)
555 LET R2=1-S7/(S(M)*S(M))
556 IF R2 > 0 THEN 560
557 LET R2=0
560 LET R=SQR(R2)
565 LET S8=SQR(S7)
570 IF P1=0 THEN 580
575 PRINT "VARIANCE-COVARIANCE MATRIX"
580 FOR I=0 TO K
585   FOR J=0 TO K
590  LET A(I,J)=A(I,J)*S7
595  IF P1=0 THEN 605
600 PRINT A(I,J),
605  NEXT J
610 IF P1=0 THEN 625
615  PRINT
620  PRINT
625 NEXT I
630 PRINT
635 PRINT "INDEX", "B", "STD. ERROR", "T-RATIO"
640 FOR I=0 TO K
645 PRINT E(I), Y(I), SQR(A(I,I)), Y(I)/SQR(A(I,I))
650 NEXT I
655 PRINT
660 PRINT "R-SQUARED=" R2, "R=" R
665 PRINT
670 PRINT "STAND. ERROR OF EST.= ";S8, "D.F.= ";N-M
675 PRINT
680 FOR I = N8 TO N9
685  LET Z=D(I,E(M))-Y(0)
690   FOR J=1 TO K
695   LET Z=Z-Y(J)*D(I,E(J))
700   NEXT J
705 LET Q(I)=Z
710 NEXT I
715 LET W=0
720 FOR I = N8 + 1 TO N9
725 LET W=W+(Q(I)-Q(I-1))*(Q(I)-Q(I-1))
730 NEXT I
735 PRINT
740 IF P2=0 THEN 775
745 PRINT "ACTUAL", "PREDICTED", "RESIDUAL"
750 FOR I = N8 TO N9
760  PRINT D(I,E(M)), D(I,E(M))-Q(I), Q(I)
770 NEXT I
775 PRINT
780 PRINT "DURBIN-WATSON STAT.=" W/S6
785 IF H<G THEN 795
790 GO TO 810
795 PRINT"***REGRESSION"H+1
797 RESTORE
800 GO TO 32
805 PRINT "CORRELATION MATRIX BECOMING SINGULAR"
810 PRINT
815 PRINT "     *****PROBLEM COMPLETED*****"
820 STOP
850 PRINT" WHICH YEARS (FROM,TO) DO YOU WISH TO USE";
855 INPUT N7,N9
860 IF N7<1948 THEN 885
862 IF N9>1968 THEN 885
865 LET N8=N7-1947
870 LET N9=N9-1947
875 RETURN
885 PRINT" DATA AVAILABLE ONLY FOR YEARS 1948 THRU 1968."
887 GO TO 850
890 LET X9=L8+L9
892 IF N8>X9 THEN 896
894 LET N8=N8+(X9-N8)+1
896 LET N=N9-N8+1
898 RETURN
900 IF L6<1 THEN 1420
920 LET Z8=0
930 LET Z8=Z8+1
940 PRINT" OPERATION"Z8"IS";
950 INPUT A6$
960 IF A6$="END" THEN 1420
970 IF A6$="A" THEN 1040
980 IF A6$="S" THEN 1160
990 IF A6$="M" THEN 1250
1000 IF A6$="D" THEN 1340
1010 PRINT" INCORRECT INSTRUCTION"
1020 GO TO 940
1040 PRINT" HOW MANY ACCOUNTS DO YOU WISH TO ADD TOGETHER";
1050 INPUT J2
1060 PRINT" WHICH ACCOUNTS"
1070 FOR J9 = 1 TO J2
1080   INPUT Z(J9)
1090 NEXT J9
1100 FOR J = N8 TO N9
1110   FOR J9=2 TO J2
1120      LET D(J,Z(1))=D(J,Z(1))+D(J,Z(J9))
1130   NEXT J9
1135 NEXT J
1140 PRINT" INDEX NUMBER OF SUMMARY ACCOUNT IS";Z(1)
1145 GO TO 930
1160 PRINT" WHICH TWO ACCOUNTS DO YOU WISH TO SUBTRACT";
1170 INPUT J2,J3
1180 FOR J = N8 TO N9
1190   LET D(J,J2)=D(J,J2)-D(J,J3)
1200 NEXT J
1205 PRINT" INDEX NUMBER OF SUMMARY ACCOUNT IS";J2
1210 GO TO 930
1250 PRINT" WHICH TWO ACCOUNTS DO YOU WISH TO MULTIPLY";
1260 INPUT J2,J3
1270 FOR J = N8 TO N9
1280   LET D(J,J2)=D(J,J2)*D(J,J3)
1290 NEXT J
1295 PRINT" INDEX NUMBER OF SUMMARY ACCOUNT IS";J2
1300 GO TO 930
1340 PRINT" WHICH TWO ACCOUNTS DO YOU WISH TO DIVIDE";
1350 INPUT J2,J3
1360 FOR J = N8 TO N9
1370   LET D(J,J2)=D(J,J2)/D(J,J3)
1380 NEXT J
1385 PRINT" INDEX NUMBER OF SUMMARY ACCOUNT IS";J2
1390 GO TO 930
1420 IF L7<1 THEN 1550
1430 PRINT" HOW MANY ACCOUNTS DO YOU WISH TO CONVERT TO LOGS";
1440 INPUT J2
1450 PRINT" WHICH ACCOUNTS"
1460 FOR I= 1 TO J2
1470   INPUT J3
1500   FOR J= N8 TO N9
1510      LET D(J,J3)=LOG(D(J,J3))
1520   NEXT J
1530 NEXT I
1550 RETURN
1800 IF L8<1 THEN 2000
1830 PRINT" HOW MANY ACCOUNTS DO YOU WISH TO LAG";
1840 INPUT J2
1850 PRINT" WHICH ACCOUNTS"
1870 FOR I= 1 TO J2
1880   INPUT J3
1890   FOR J=N9 TO N8 STEP-1
1900      LET D(J,J3)=D(J-1,J3)
1910   NEXT J
1920 NEXT I
2000 IF L9<1 THEN 2150
2030 PRINT" OF HOW MANY ACCOUNTS DO YOU WISH TO TAKE FIRST DIFFERENCES";
2040 INPUT J4
2050 PRINT" WHICH ACCOUNTS"
2065 FOR I= 1 TO J4
2070   INPUT J5
2080   FOR J=N9 TO N8 STEP-1
2090      LET D(J,J5)=D(J,J5)-D(J-1,J5)
2100   NEXT J
2110 NEXT I
2150 RETURN
9000 'NATIONAL INCOME ACCOUNTS
9010 'GROSS NATIONAL PRODUCT
9011 DATA 257.6,256.5,284.8,328.4,345.5,364.6,364.8,398
9012 DATA 419.2,441.1,447.3,483.7,503.7,520.1,560.3,590.5,632.4
9013 DATA 684.9,747.6,789.7,860.7
9020 'PERSONAL CONSUMPTION EXPENDITURES
9021 'DURABLE GOODS
9022 DATA 22.7,24.6,30.5,29.6,29.3,33.2,32.8,39.6,38.9,40.8
9023 DATA 37.9,44.3,45.3,44.2,49.5,53.9,59.2,66.3,70.5,72.6,82.5
9025 'NONDURABLE GOODS
9026 DATA 96.2,94.5,98.1,108.8,114,116.8,118.3,123.3,129.3
9027 DATA 135.6,140.2,146.6,151.3,155.9,162.6,168.6,178.7,191.2
9028 DATA 206.7,215.8,230.2
9030 'SERVICES
9031 DATA 54.7,57.6,62.4,67.9,73.4,79.9,85.4,91.4,98.5,105,112
9032 DATA 120.3,128.7,135.1,143,152.4,163.3,175.5,188.3,203.8,221
9040 'PRIVATE DOMESTIC INVESTMENT
9045 'NONRESIDENTIAL STRUCTURES
9046 DATA 8.8,8.5,9.2,11.2,11.4,12.7,13.1,14.3,17.2,18,16.6
9047 DATA 16.7,18.1,18.4,19.2,19.5,21.2,25.5,28.5,27.9,29.2
9050 'PRODUCERS DURABLE EQUIPMENT
9051 DATA 18.1,16.6,18.7,20.7,20.2,21.5,20.6,23.8,26.5,28.4
9052 DATA 25,28.4,30.3,28.6,32.5,34.8,39.9,45.8,52.8,55.7,60.8
9055 'RESIDENTIAL STRUCTURES
9056 DATA 14.4,13.7,19.4,17.2,17.2,18,19.7,23.3,21.6,20.2
9057 DATA 20.8,25.5,22.8,22.6,25.3,27,27.1,27.2,24.8,24.6,30
9060 'CHANGE IN BUSINESS INVENTORIES
9061 DATA 4.7,-3.1,6.8,10.3,3.1,0.4,-1.5,6,4.7,1.3,-1.5,4.8
9062 DATA 3.6,2,6,5.9,5.8,9.6,14.7,6.1,7.6
9070 'NET EXPORTS OF GOODS AND SERVICES
9071 DATA 6.4,6.1,1.8,3.7,2.2,0.4,1.8,2,4,5.7,2.2,0.1,4
9072 DATA 5.6,5.1,5.9,8.5,6.9,5.1,4.8,2.4
9080 'GOVERNMENT PURCHASES OF GOODS AND SERVICES
9081 'NATIONAL DEFENSE
9082 DATA 10.7,13.3,14.1,33.6,45.9,48.7,41.2,38.6,40.3,44.2,45.9
9083 DATA 46,44.9,47.8,51.6,50.8,50,50.1,60.6,72.4,78.9
9085 'OTHER FEDERAL
9086 DATA 5.8,6.8,4.3,4.1,5.9,8.4,6.2,5.5,5.3,5.3,7.7,7.6,8.6
9087 DATA 9.6,11.8,13.5,15.2,16.8,16.8,18.2,21.1
9090 'STATE AND LOCAL
9091 DATA 15,17.7,19.5,21.5,22.9,24.6,27.4,30.1,33,36.6,40.6
9092 DATA 43.3,46.1,50.2,53.7,58.2,63.5,70.1,78.8,87.8,97.1
9100 'IMPLICIT PRICE DEFLATORS
9110 'PRICE DEFLATORS FOR GNP
9111 DATA .796,.791,.802,.856,.875,.883,.896,.909,.940,.975
9112 DATA 1.00,1.016,1.033,1.046,1.058,1.072,1.088,1.109,1.139
9113 DATA 1.173,1.218
9120 'PRICE DEFLATORS FOR PERSONAL CONSUMPTION EXPENDITURES
9125 'PRICE DEFLATORS FOR DURABLE GOODS
9126 DATA .863,.868,.878,.942,.954,.943,.929,.919,.949,.984,1.0
9127 DATA 1.014,1.009,1.006,1.008,1.004,1.004,.996,.988,1.004,1.031
9130 'PRICE DEFLATORS FOR NONDURABLE GOODS
9131 DATA .885,.856,.860,.933,.943,.939,.942,.936,.949,.977,1,.999
9132 DATA 1.012,1.019,1.028,1.04,1.049,1.069,1.106,1.129,1.169
9135 'PRICE DEFLATORS FOR SERVICES
9136 DATA .721,.743,.763,.8,.836,.877,.9,.92,.946,.973,1,1.03
9137 DATA 1.058,1.076,1.09,1.109,1.131,1.151,1.181,1.221,1.272
9150 'PRICE DEFLATORS FOR PRIVATE DOMESTIC INVESTMENT
9151 'PRICE DEFLATORS FOR NONRESIDENTIAL STRUCTURES
9152 DATA .715,.712,.729,.793,.832,.849,.86,.881,.934,.986,1,1.027
9153 DATA 1.04,1.056,1.071,1.089,1.111,1.147,1.19,1.236,1.297
9160 'PRICE DEFLATORS FOR PRODUCERS DURABLE EQUIPMENT
9161 DATA .703,.736,.752,.809,.822,.835,.84,.859,.918,.975,1,1.02
9162 DATA 1.022,1.021,1.023,1.023,1.03,1.039,1.06,1.091,1.12
9170 'PRICE DEFLATORS FOR RESIDENTIAL STRUCTURES
9171 DATA .808,.785,.825,.886,.908,.919,.904,.929,.974,.998,1,1.031
9172 DATA 1.045,1.05,1.067,1.089,1.123,1.142,1.174,1.231,1.299
9180 'PRICE DEFLATORS FOR GOVERNMENT PURCHASES OF GOODS AND SERVICES
9181 'PRICE DEFLATORS FOR FEDERAL GOVERNMENT
9182 DATA .698,.73,.729,.794,.812,.814,.835,.869,.917,.958,1,1.022
9183 DATA 1.042,1.052,1.056,1.08,1.122,1.155,1.188,1.212,1.261
9190 'PRICE DEFLATORS FOR STATE AND LOCAL GOVERNMENTS
9191 DATA .664,.689,.708,.769,.806,.828,.853,.875,.927,.973,1,1.026
9192 DATA 1.059,1.094,1.132,1.163,1.195,1.235,1.284,1.333,1.388
9200 'TOTAL DISPOSABLE PERSONAL INCOME
9205 DATA 189.1,188.6,206.9,226.6,238.3,252.6,257.4,275.3
9206 DATA 293.2,308.5,318.8,337.3,350.0,364.4,385.3,404.6,438.1
9207 DATA 473.2,511.6,546.3,589
9210 'DPI:INTEREST PAID & TRANSFER PAYMENTS TO FOREIGNERS
9211 DATA 2.2,2.4,2.9,3.1,3.5,4.3,4.6,5.1,5.9,6.4,6.5,7.1,7.8
9212 DATA 8.1,8.6,9.7,10.7,12,13.1,13.9,14.4
9220 'GOVERNMENT TAX & NONTAX RECEIPTS OR ACCRUALS
9221 DATA 58.9,56,68.7,84.8,89.8,94.3,89.7,100.4,109,115.6
9222 DATA 114.7,128.9,139.8,144.6,157,168.8,174.1,189.1,213.2
9223 DATA 227.4,260.9
9230 'GOVERNMENT TRANSFERS,INTEREST & SUBSIDIES
9231 DATA 18.8,21.3,22.9,19.9,19,19.5,21.9,23.4,25.5,28.7,33,34
9232 DATA 36.5,41.3,42.8,44.4,46.7,49.9,55.3,62.9,70.2
9240 'GROSS BUSINESS RETAINED EARNINGS
9241 DATA 28,29.7,29.4,33.1,35.1,36.1,39.2,46.3,47.3,49.8,49.4
9242 DATA 56.8,56.8,58.7,66.3,68.8,76.2,84.7,91.6,93.1,97.5
9250 'TRANSFERS TO FOREIGNERS BY PERSONS AND GOVERNMENT
9251 DATA 4.5,5.6,4,3.5,2.5,2.5,2.3,2.5,2.4,2.3,2.4,2.4,2.4,2.6
9252 DATA 2.7,2.8,2.8,2.8,2.9,3.1,2.7
9260 'STATISTICAL DISCREPANCY BETWEEN GNP AND TOTAL INCOME OR RECEIPTS
9261 DATA -2,0.3,1.5,3.3,2.2,3,2.7,2.1,-1.1,0,1.6,-0.8,-1,-0.8
9262 DATA 0.5,-0.3,-1.3,-3.1,-3.3,-3.5,-4.7
9999 END