Trailing-Edge
-
PDP-10 Archives
-
decuslib10-01
-
43,50110/fcst2.tuk
There are 2 other files named fcst2.tuk in the archive. Click here to see a list.
10' * FORECAS2 * REVISED 9/30/68 GUERBER
20' USE SYSTEM 'XBA'
30' TO USE THIS PROGRAM YOU MUST HAVE YOUR DATA SAVED UNDER YOUR
40' USER NUMBER IN A FILE WITH NAME F2IN.BAS . YOU MUST ALSO
50' HAVE A 'SCRATCH' FILE SAVED UNDER YOUR USER NUMBER.
60' THIS FILE MUST BE NAMED 'DATA'.
100 FILES DATA ,F2IN
110 PRINT "WHAT IS THE NAME OF THE FILE CONTAINING THE DATA";
120 INPUT A$
160 READ #2,S(N1+1)
170 IF END #2 THEN 240
180 LET N1=N1+1
190 GOTO 160
240 SCRATCH #1
241 PRINT "HOW MANY PERIODS ARE TO BE USED FOR INITIALIZATION"
242 PRINT "[MUST BE LESS THAN"N1"]";
243 INPUT N2
244 PRINT "DO YOU WANT NUMERICAL OUTPUT, A GRAPH, OR BOTH";
245 INPUT A$
246 CHANGE A$ TO A
247 LET A(0)=3
248 CHANGE A TO A$
250 PRINT
260 PRINT
270 PRINT
280 DIM B(200),C(200),D(200),E(200),F(200),G(200),H(200)
290 DIM J(200),K(200),L(200),M(200),N(200),Q(200),S(200),T(200)
300 LET A1 = .1
320 WRITE #1,5;N2+1;N1-N2
360 PRINT "NUMBER OF PERIODS OF DATA ENTERED:",N1
370 PRINT "NUMBER OF PERIODS TO INITIALIZE:",N2
380 PRINT "VALUE OF SMOOTHING CONSTANT: ",A1
390 PRINT
400 PRINT
401 PRINT " 1 2 3 4 5"
410 PRINT "PERIOD SALES SIMPLE SECOND DOUBLE TRIPLE"
420 PRINT " EXPONENTIAL ORDER EXPONENTIAL EXPONENTIAL"
430 PRINT " SMOOTHING EXPONENTIAL SMOOTHING SMOOTHING"
440 PRINT " SMOOTHING"
450 LET F(2) = (S(1)+S(2))/2
460 FOR I = 3 TO N1
470 LET F(I) = A1*S(I) + (1-A1)*F(I-1)
480 NEXT I
490 LET T(2) = S(2) - S(1)
500 LET E(2) = ((S(1)+S(2))/2)+.5*T(2)
510 FOR I = 3 TO N1
520 LET E(I) = A1*S(I)+(1-A1)*(E(I-1)+T(I-1))
530 LET T(I) = E(I)-E(I-1)
540 LET D(I+1) = E(I) + T(I)
550 NEXT I
555 LET E2 = E(I)
557 LET T2 = T(I)
560 LET B(2) = S(2)-(((1-A1)/A1)*(S(2)-S(1)))
570 LET C(2) = S(2)-(2*((1-A1)/A1)*(S(2)-S(1)))
580 FOR I = 3 TO N1
590 LET B(I) = A1*S(I) + (1-A1)*B(I-1)
600 LET C(I) = A1*B(I) + (1-A1)*C(I-1)
610 LET T(I) = (A1/(1-A1))*(B(I)-C(I))
620 LET G(I) = 2*B(I)-C(I)
630 LET H(I+1) = G(I) + T(I)
640 NEXT I
642 LET E3 = G(I)
644 LET T3 = T(I)
650 LET J(2) = (S(2) + S(1))/2
660 LET K(2) = J(2)
670 LET L(2) = J(2)
680 FOR I = 3 TO N1
690 LET J(I) = A1*S(I) + (1-A1)*J(I-1)
700 LET K(I) = A1*J(I) + (1-A1)*K(I-1)
710 LET L(I) = A1*K(I) + (1-A1)*L(I-1)
720 LETT(I)=(A1/(2*(1-A1)^2))*((6-5*A1)*J(I)-2*(5-4*A1)*K(I)+(4-3*A1)*L(I))
730 LET Q(I) = ((A1^2)/((1-A1)^2))*(J(I)-2*K(I)+L(I))
740 LET M(I) = 3*J(I) - 3*K(I) + L(I)
750 LET N(I+1) = M(I) + T(I) + .5*Q(I)
760 NEXT I
762 LET E4 = M(I)
764 LET T4 = T(I)
766 LET Z4 = Q(I)
770 LET S1 = 0
780 LET S2 = 0
790 LET S3 = 0
800 LET S4 = 0
810 LET S5 = 0
820 LET S6 = 0
830 LET S7 = 0
840 LET S8 = 0
850 LET S9 = 0
860 FOR I = N2 + 1 TO N1
870 LET S1 = S1 + ABS(S(I)-F(I-1))
880 LET S2 = S2 + ABS(S(I)-D(I))
890 LET S3 = S3 + ABS(S(I)-H(I))
900 LET S4 = S4 + ABS(S(I) -N(I))
910 LET S5 = S5 + (S(I)-S(I-1))^2
920 LET S6 = S6 + ((F(I-1)-S(I-1))-(S(I)-S(I-1)))^2
930 LET S7 = S7 + ((D(I) -S(I-1))-(S(I)-S(I-1)))^2
940 LET S8 = S8 + ((H(I)-S(I-1))-(S(I)-S(I-1)))^2
950 LET S9 = S9 + ((N(I)-S(I-1))-(S(I)-S(I-1)))^2
960 NEXT I
970 LET S1 = S1/(N1-N2)
980 LET S2 = S2/(N1-N2)
990 LET S3 = S3/(N1-N2)
1000 LET S4 = S4/(N1-N2)
1010 LET S6 = S6/S5
1020 LET S7 = S7/S5
1030 LET S8 = S8/S5
1040 LET S9 = S9/S5
1050 FOR I = N2 + 1 TO N1
1055 IF A$="GRA" THEN 1070
1060 PRINT I;TAB(8);S(I);TAB(18);F(I-1);TAB(30);D(I);TAB(45);H(I);TAB(60);N(I)
1070 WRITE #1,S(I);F(I-1);D(I);H(I);N(I)
1080 NEXT I
1090 PRINT
1100 PRINT "MEAN ABSOLUTE DEVIATION"
1110 PRINT " "S1,S2,S3,S4
1120 PRINT "THEIL'S 'U' SQUARED"
1130 PRINT " "S6,S7,S8,S9
1135 GO SUB 1300
1140 IF A$="NUM" THEN 9999
1150 PRINT "SYMBOL ON PLOT:"
1160 PRINT " 1 2 3 4 5"
1170 PRINT"'*'DENOTES TWO OR MORE POINTS ON SAME SPOT."
1190 CHAIN "PLOTT***"
1300 PRINT
1310 PRINT
1320 PRINT "DO YOU WANT TO FORECAST";
1330 INPUT Q$
1340 IF Q$="NO" THEN 1500
1350 PRINT "HOW MANY PERIODS DO YOU WANT";
1360 INPUT N3
1370 PRINT
1380 PRINT
1385 PRINT "FORECAST"
1387 PRINT "--------"
1388 PRINT
1390 FOR I = N1+1 TO N1+N3
1400 LET F(I) = F(N1)
1410 LET D(I) = E2+(I-N1)*T2
1420 LET H(I) = E3+(I-N1)*T3
1430 LET N(I) = E4+(I-N1)*T4+.5*((I-N1)^2)*Z4
1440 PRINT I;TAB(18);F(I);TAB(30);D(I);TAB(45);H(I);TAB(60);N(I)
1450 WRITE#1,S(I);F(I);D(I);H(I);N(I)
1460 NEXT I
1480 PRINT
1490 PRINT
1500 RETURN
9999 END