Forecasting Graph

Date: 1982
Type: Cassette
Platform(s): TS 1000

This is a quickload program. It is comprised of a short speed loader in normal ZX81/TS1000 format followed by the actual program in a format similar to the Spectrum and TS2068 tape format.

  • FC-Grph.z81 is an EightyOne emulator snapshot of the running program.
  • FC-Grph.wav has been edited to remove noise and provide more of a square wave signal.
  • FC-Grph.b81 is an EightyOne emulator text listing.

Related Products

Takes raw data and projects sales, profits, inflation, and other trends. Computes a moving average that smooths out seasonal and random fluctuations. Stores up to 15 time series of 60 periods each. Analyzes growth rates, correlates two separate trends, computes mean and standard deviation. Results can be displayed in graph form. 16K.

Gallery

Forecasting Graph

Source Code

  10 REM \8D\40\1C\00\00\03\00\03\03\03\03\03\03\03\03\03\03\03\08\03\03\03\03\03\03\03\03\08\05\09\0D\0F\13\16\1C\16\16\14\17\18\1D\22\20\20\1E\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\03\21\86\40\00\00\2B\2B\00\00\2B\36\40\2B\36\89\3A\87\40\32\88\40\2A\82\40\5E\7B\32\85\40\3A\85\40\47\3A\84\40\4F\16\9B\7A\CD\B2\0B\3A\85\40\4F\0D\79\32\85\40\20\E7\21\84\40\56\14\72\3A\88\40\3D\32\88\40\20\D0\ED\5B\82\40\13\ED\53\82\40\3A\86\40\3D\32\86\40\20\B8\C9\1D\1F\20\21\22\23\24\25\1C\1D\1E\1F\20\21\22\23\24\25\1C\1D\1E\1F\20\21\22\23\24\25\1C
  15 REM SZX-TSA V2820605
  20 GOTO OA
 110 LET Z$=INKEY$
 120 IF Z$="" OR Z$<>"Y" AND Z$<>"N" THEN GOTO 110
 199 RETURN 
 203 FAST 
 205 PRINT H$;TAB O8;"%D%E%S%C%R%I%P%T%I%O%N      %P%E%R%I%O%D"
 210 FOR K=O1 TO OD
 220 PRINT TAB O1;K;".";TAB O4;T$(K);" ";P$(K)
 230 NEXT K
 240 SLOW 
 299 RETURN 
 300 FAST 
 307 PRINT AT O1,O0;I;"  ";T$(K);" ";P$(K)
 310 FOR J=O1 TO OC
 315 FOR L=O0 TO 40 STEP OC
 320 LET Z$="       "
 325 LET Y$=STR$ T(I,J+L)
 330 IF LEN Y$>=O7 THEN GOTO 345
 335 LET Z$(O7-LEN Y$ TO O7)=Y$
 340 GOTO 350
 345 LET Z$=Y$( TO O7)
 350 PRINT J+L;
 355 IF J+L<10 THEN PRINT " ";
 360 PRINT "\##";Z$;
 365 IF L<30 THEN PRINT "% ";
 370 NEXT L
 375 NEXT J
 380 SLOW 
 399 RETURN 
 410 FOR K=O1 TO OG
 420 LET P(K)=O0
 430 NEXT K
 499 RETURN 
 510 LET Z$=INKEY$
 520 IF Z$="" OR CODE Z$<28 AND Z$<>"." OR CODE Z$>37 THEN GOTO 510
 530 LET Y$=Y$+Z$
 599 RETURN 
 610 LET Z$=INKEY$
 620 IF Z$="" OR CODE Z$<28 AND Z$<>"." OR CODE Z$>37 AND CODE Z$<>114 AND CODE Z$<>118 THEN GOTO 610
 630 IF CODE Z$=114 THEN GOTO 2000
 640 IF CODE Z$=118 THEN GOTO 690
 650 LET Y$=Y$+Z$
 660 RETURN 
 690 LET L=O7
 699 RETURN 
 705 CLS 
 720 GOSUB OB
 730 PRINT ,,"WHICH TIME SERIES DO YOU WISH TO USE ?  \##\##"
 740 INPUT Y
 750 IF Y>OD THEN GOTO 740
 760 PRINT AT OC,O8;Y
 770 LET I=Y
 780 LET K=Y
 790 PRINT "ACCEPT ?"
 800 GOSUB OE
 810 IF Z$="N" THEN GOTO 700
 820 CLS 
 899 RETURN 
 910 CLS 
 920 PRINT H$,,O$(O),,,"ENTER NO. OF SERIES %A"
 930 INPUT A
 940 IF A>OD THEN GOTO 930
 945 PRINT AT O5,OF;A
 950 PRINT ,,"ENTER NO. OF SERIES %B"
 960 INPUT I
 970 IF I>OD THEN GOTO 960
 980 PRINT AT O7,OF;I
 999 RETURN 
1010 FOR J=O1 TO OG
1020 LET P(J)=T(I,J)
1030 NEXT J
1099 RETURN 
1110 LET SQ=O0
1120 LET SU=O0
1130 FOR J=O1 TO PER
1140 LET SU=SU+T(I,J)
1150 LET SQ=SQ+T(I,J)**O2
1160 NEXT J
1170 LET AV=SU/PER
1180 LET DEV=SQR (SQ/PER-AV**O2)
1199 RETURN 
1600 PAUSE OB
1610 POKE OH,OI
1699 RETURN 
2010 CLS 
2020 PRINT H$,,TAB OW;"%O%P%T%I%O%N%S"," "
2030 FOR K=O1 TO O6
2040 PRINT " ";K;". ";O$(K);,,,
2050 NEXT K
2060 PRINT ,,TAB O5;"ENTER OPTION."
2070 LET Z$=INKEY$
2080 IF Z$="" OR CODE Z$<29 OR CODE Z$>34 THEN GOTO 2070
2090 CLS 
2100 GOTO VAL Z$*OU+OA
3020 GOSUB OB
3050 PRINT ,,"ENTER NO. OF SERIES TO BE SET UP"
3060 INPUT I
3070 IF I>OD THEN GOTO 3060
3100 PRINT AT 18,OD;I
3130 IF T$(I)=M$ THEN GOTO 3200
3140 PRINT "TIME SERIES ";I;" IN USE - PROCEED ?"
3150 GOSUB OE
3160 IF Z$="N" THEN GOTO OA
3200 CLS 
3210 PRINT H$,," TIME SERIES NUMBER ";I,,," TIME SERIES NAME (MAX 19 CHR$ )",,,"  ";M$
3220 INPUT Y$
3230 IF LEN Y$>19 THEN GOTO 3220
3280 PRINT AT O6,O2;Y$
3310 PRINT ,," PERIOD DEFINITION (MAX 7 CHR$ )"
3330 INPUT X$
3340 IF LEN X$>O7 THEN GOTO 3330
3380 PRINT AT O9,O2;X$
3400 PRINT ,," ACCEPT ?"
3410 GOSUB OE
3420 IF Z$="N" THEN GOTO 3200
3430 LET T$(I)=Y$
3440 LET P$(I)=X$
3450 LET Q$(I)="\##\##\##\##\##\##\##\##\##\##"
3455 FAST 
3460 FOR J=O1 TO OG
3470 LET T(I,J)=O0
3480 NEXT J
3485 SLOW 
3490 PRINT ,,,," SERIES NOW SET UP WITH 60 BLANK PERIODS"
3500 PAUSE OB
3510 POKE OH,OI
3999 GOTO OA
4010 PRINT H$
4015 GOSUB OJ
4020 GOSUB OK
4030 SCROLL 
4040 PRINT "NO. OF PERIODS DATA TO ENTER? \@@\@@"
4050 INPUT Y
4060 IF Y>OG THEN GOTO 4050
4100 PRINT AT  OT,O0;Y;" PERIODS STARTING PERIOD ?  \@@\@@"
4110 INPUT STA
4120 IF STA<O1 OR STA>OG THEN GOTO 4110
4200 FOR J=STA TO STA+Y-1
4210 PRINT AT  OT,O0;"PERIOD ";J;" \##\##\##\##\##\##\##";M$( TO 15)
4220 INPUT X
4230 IF LEN (STR$ X)>O7 THEN GOTO 4220
4240 PRINT AT  OT,OL;X
4260 PRINT AT  OT,18;"ACCEPT ?"
4270 GOSUB OE
4280 IF Z$="N" THEN GOTO 4210
4290 LET T(I,J)=X
4300 LET Y$="       "
4310 LET Z$=STR$ T(I,J)
4320 LET L=LEN Z$
4330 LET Y$(O8-L TO )=Z$
4340 PRINT AT  J-OC*(J>OC)-OC*(J>40),O2+11*(J>OC)+11*(J>40);Y$
4350 NEXT J
4500 CLS 
4510 PRINT H$,,"PERIOD ";Q(I);" CURRENTLY IDENTIFIED   AS ";Q$(I),"CHANGE THIS ? \@@"
4520 GOSUB OE
4530 IF Z$="N" THEN GOTO OA
4540 PRINT ;,,"ENTER NEW PERIOD AND IDENTIFY",,,"\@@\@@  \@@\@@\@@\@@\@@\@@\@@\@@\@@\@@\@@\@@\@@\@@\@@"
4550 INPUT Y
4560 IF LEN (STR$ Y)>O2 THEN GOTO 4550
4570 PRINT AT  O9,O0;Y
4590 INPUT X$
4600 IF LEN X$>15 THEN GOTO 4590
4620 PRINT AT  O9,O5;X$
4640 PRINT ,,"ACCEPT ?"
4650 GOSUB OE
4660 IF Z$="N" THEN GOTO 4500
4670 LET Q(I)=Y
4680 LET Q$(I)=X$
4999 GOTO OA
5005 CLS 
5010 PRINT H$,,TAB OW;"OPTIONS",
5020 FOR K=O7 TO 15
5030 PRINT " ";K-O6;". ";O$(K)
5040 NEXT K
5050 PRINT ,,"ENTER OPTION"
5060 INPUT Z
5070 IF Z<O1 OR Z>O9 THEN GOTO 5060
5092 LET O=Z+6
5095 GOTO Z*OE+OM
5100 GOSUB OJ
5102 IF I>OD THEN GOTO 5100
5104 PRINT TAB O5;O$(O7),,,"HOW MANY PERIODS IN MOVING AVERAGE ? \@@\@@"
5106 INPUT PER
5108 IF PER>30 THEN GOTO 5106
5110 PRINT AT  O3,O8;PER
5120 FAST 
5126 GOSUB ON
5128 FOR J=PER TO OG
5130 FOR K=O1 TO PER
5132 LET P(J)=P(J)+T(I,J-K+O1)
5134 NEXT K
5136 NEXT J
5138 SLOW 
5140 PRINT ,,"MOVING AVERAGE OF SERIES ";I;A$
5150 GOSUB OX
5199 GOTO OM
5200 GOSUB OP
5204 GOSUB ON
5205 FAST 
5206 FOR J=O1 TO OG
5207 IF T(I,J)=O0 THEN LET P(J)=999999
5208 IF T(I,J)=O0 THEN GOTO 5210
5209 LET P(J)=T(A,J)*OE/T(I,J)
5210 NEXT J
5212 SLOW 
5214 PRINT "PERCENTAGES";A$
5216 GOSUB OX
5299 GOTO OM
5300 GOSUB OJ
5302 PRINT H$,,O$(O),,,"ENTER NO.OF PERIODS LAG  \@@\@@"
5304 INPUT LAG
5310 PRINT AT  O5,27;LAG
5316 IF LAG<O1 OR  LAG>58 THEN GOTO 5300
5317 FAST 
5318 GOSUB ON
5320 FOR J=O1+LAG TO OG
5321 IF NOT T(I,J-LAG) THEN LET P(J)=999999
5322 IF NOT T(I,J-LAG) THEN GOTO 5324
5323 LET P(J)=T(I,J)*OE/T(I,J-LAG)-OE
5324 NEXT J
5325 SLOW 
5326 PRINT ,,"GROWTH RATES COMPUTED AND";A$
5328 GOSUB OX
5399 GOTO OM
5400 GOSUB OJ
5402 PRINT H$,,O$(O),,,"ENTER NO.OF PERIODS SHIFT \@@\@@"
5404 INPUT Y
5406 IF Y>=OG THEN GOTO 5404
5410 PRINT AT  O5,26;Y
5416 PRINT ,,"DIRECTION OF SHIFT?",,"LEFT%< OR RIGHT %>  \@@"
5418 LET Z$=INKEY$
5420 IF Z$<>"<" AND Z$<>">" THEN GOTO 5418
5422 IF Z$="<" THEN LET Y=Y*-O1
5424 PRINT AT  O8,18;Z$
5426 PRINT ,,"ACCEPT ?"
5428 GOSUB OE
5430 IF Z$="N" THEN GOTO 5400
5431 FAST 
5432 FOR J=O0+O1*(Y<O0)+OG*(Y>O0) TO (O1*(Y>O0)+Y*(Y>O0))+(OG+Y)*(Y<O0) STEP -O1*(SGN Y)
5434 LET T(I,J)=T(I,J-Y)
5436 NEXT J
5437 SLOW 
5438 PRINT ,,"SERIES NO. ";I;" SHIFTED ";Y;" PERIODS"
5440 GOSUB OX
5499 GOTO OM
5500 GOSUB OP
5502 IF A>OD OR I>OD THEN GOTO 5500
5504 FAST 
5506 LET B=I
5508 LET I=A
5509 LET PER=OG
5510 GOSUB OR
5512 LET AA=AV
5514 LET SA=DEV
5516 LET I=B
5518 GOSUB OR
5520 LET AB=AV
5522 LET SB=DEV
5524 LET Z=O0
5526 FOR J=O1 TO OG
5528 LET Z=Z+((T(A,J)-AA)/SA)*((T(B,J)-AB)/SB)
5530 NEXT J
5532 LET Z=Z/OG
5533 SLOW 
5534 PRINT ,,"CORRELATION COEFFICIENT IS ";Z
5538 PRINT K$
5540 IF INKEY$="" THEN GOTO 5540
5599 GOTO OM
5600 GOSUB OJ
5602 GOSUB OK
5603 SCROLL 
5604 PRINT "PRESS %C TO COPY-ANY TO RETURN"
5606 LET Z$=INKEY$
5608 IF Z$="" THEN GOTO 5606
5610 IF Z$="C" THEN COPY 
5699 GOTO OM
5700 GOSUB OJ
5702 PRINT H$,,O$(O),,,"ENTER %1 TO COPY TO OR %2 TO COPY FROM THE UTILITY SERIES"
5704 INPUT Y
5706 IF Y<O1 OR Y>O2 THEN GOTO 5704
5708 FAST 
5710 IF Y=O2 THEN GOTO 5716
5712 GOSUB OU
5714 GOTO 5722
5716 FOR J=O1 TO OG
5718 LET T(I,J)=P(J)
5720 NEXT J
5722 PRINT ,,"SERIES COPIED"
5723 SLOW 
5724 GOSUB OX
5799 GOTO OM
5800 GOSUB OJ
5802 PRINT H$,,O$(O),"ENTER NUMBER OF RELEVANT PERIODS"
5804 INPUT PER
5806 IF PER>OG THEN GOTO 5804
5808 PRINT ,PER
5814 FAST 
5816 GOSUB OR
5818 PRINT ,,"STANDARD DEVIATION IS ";DEV,"MEAN IS ";AV
5820 SLOW 
5828 PRINT K$
5830 IF INKEY$="" THEN GOTO 5830
5899 GOTO OM
5900 GOTO OA
6100 CLS 
6110 PRINT H$,,"          %G%R%A%P%H% %P%L%O%T",,,"NUMBER OF START PERIOD ? ";
6120 INPUT STA
6155 PRINT STA
6170 IF STA<O1 OR  STA>=OG THEN GOTO 6100
6180 PRINT ,,"NUMBER OF PERIODS ? ";
6190 INPUT PER
6230 PRINT PER
6250 IF STA+PER-O1>OG THEN GOTO 6100
6260 LET Y=P(STA)
6270 LET Z=P(STA)
6280 FOR K=STA TO STA+PER-O1
6290 IF P(K)<Y THEN LET Y=P(K)
6300 IF P(K)>Z THEN LET Z=P(K)
6310 NEXT K
6320 PRINT ,,"MAXIMUM VALUE IN RANGE IS ";Z,"MINIMUM VALUE IN RANGE IS ";Y,"RANGE IS ";Z-Y,,"ENTER BASE VALUE FOR PIXEL 0 ";
6330 INPUT X
6340 PRINT X
6350 PRINT "ENTER TOP VALUE FOR PIXEL 36 ";
6360 INPUT W
6370 PRINT W
6390 IF X>Y OR W<Z THEN GOTO 6100
6400 PRINT "%B%A%S%E% %V%A%L%U%E% %I%S    ";X,"%M%I%N%I%M%U%M% %V%A%L%U%E% %I%S ";Y,"%M%A%X%I%M%U%M% %V%A%L%U%E% %I%S ";Z,"%T%O%P% %O%F% %G%R%A%P%H% %I%S ";W,"ACCEPT ?"
6410 GOSUB OE
6420 IF Z$="N" THEN GOTO 6000
6430 CLS 
6435 FAST 
6440 LET F=(W-X)/36
6450 FOR K=STA TO STA+PER-O1
6460 LET Z=INT ((P(K)-X)/F)
6470 IF Z<O1 THEN LET Z=O1
6480 POKE (16521+K-STA),Z+O2
6490 NEXT K
6500 POKE 16518,PER
6505 LET Y=O4+12*(PER<OS)+INT (.5*(OG-PER)*(PER<OG AND PER>25))
6507 POKE 16516,Y
6510 LET Z=O1*(PER>24)+O2*(PER<OS)+O1*(PER<15)
6520 POKE 16519,Z
6525 SLOW 
6530 RAND USR 16581
6540 LET X=INT (Y/O2)
6550 IF X<3 THEN GOTO 6630
6560 FOR K=18 TO O0  STEP -O2
6565 LET X$=M$( TO X-O1)
6570 LET Z$=STR$ (W-(F*((K*O2)-O1)))
6571 IF LEN Z$>=X THEN GOTO 6574
6572 LET X$((X-O1)-LEN Z$ TO X-O1)=Z$
6573 GOTO 6575
6574 LET X$=Z$( TO X-O1)
6575 PRINT AT  K+O2,O0;X$;TAB X-O1;"\##"
6580 PRINT AT  K+O3,X-O1;"\@@"
6590 NEXT K
6630 PRINT AT  O0,O0;"%E%N%T%E%R% %T%I%T%L%E"
6640 INPUT Z$
6650 LET L=INT ((LEN Z$)/O2)
6660 PRINT AT  O0,O0;"           "
6670 PRINT AT  O0,16-L;Z$
6672 INPUT Z$
6674 PRINT AT OT,O0;Z$
6760 LET Z$=INKEY$
6770 IF Z$="C" THEN COPY 
6790 IF CODE Z$<>OV THEN GOTO 6760
6800 GOTO OA
7010 GOSUB OJ
7020 PRINT H$,,"          %F%O%R%E%C%A%S%T%I%N%G",,,"ENTER NO. OF PERIODS IN MOVING  AVERAGE"
7030 INPUT W
7040 IF W>30 THEN GOTO 7030
7060 PRINT AT O6,O8;W
7090 PRINT ,,"ENTER NO. OF PERIODS TO BE      FORECAST"
7100 INPUT PER
7130 PRINT AT  O9,OL;PER
7160 PRINT ,,"ENTER NO. OF START PERIOD FOR   FORECAST"
7170 INPUT X
7200 PRINT AT  OW,OL;X
7230 IF X-W*O2>=O1 AND X+PER<=OG THEN GOTO 7270
7240 PRINT "PARAMETERS DO NOT FIT"
7250 GOSUB OX
7265 GOTO 7000
7270 FAST 
7280 GOSUB ON
7300 LET FZ=O0
7310 LET FX=O0
7320 FOR K=O1 TO W
7330 LET FZ=FZ+K**O2
7340 LET FX=FX+K
7350 NEXT K
7355 LET Z=I
7360 FOR J=O1 TO W
7370 LET MA=O0
7380 FOR K=O1 TO W
7390 LET MA=MA+T(Z,J+X-O2*W+K-O1)
7400 NEXT K
7410 LET P(X-W+J-O1)=MA
7420 NEXT J
7430 FOR I=1 TO PER
7440 LET SY=O0
7450 LET SX=O0
7460 FOR K=O1 TO W
7470 LET SY=SY+P(X+I-W+K-O2)
7480 LET SX=SX+P(X+I-W+K-O2)*K
7490 NEXT K
7500 LET SL=(SY*FX/W-SX)/((FX**O2)/W-FZ)
7510 LET IN=(SY-SL*FX)/W
7520 LET MA=SL*(W+I)+IN
7530 LET V1=.5*(P(X+I-O2)-(SL*(W+I-O1)+IN))
7540 LET V2=.25*(P(X+I-O3)-(SL*(W+I-O2)+IN))
7550 LET V3=.25*(P(X+I-O4)-(SL*(W+I-O3)+IN))
7555 LET SOS=V1+V2+V3
7560 LET MB=MA+SOS
7570 LET P(X+I-O1)=MB
7580 LET T(Z,X+I-O1)=T(Z,X+I-O1-W)+(P(X+I-O1)-P(X+I-O2))
7590 NEXT I
7595 SLOW 
7600 PRINT "FORECAST IS NOW IN  SERIES ";Z,"AND MOVING AVERAGE OF FORECAST","IS IN UTILITY ARRAY"
7610 PAUSE OB
7620 POKE OH,OI
7630 GOTO OA
8000 PRINT H$,,"SAVE REQUIRED ?"
8010 GOSUB OE
8020 IF Z$="N" THEN GOTO 9999
8030 PRINT "ENTER NAME"
8040 INPUT Z$
8050 PRINT "%S%T%A%R%T% %T%A%P%E% %T%H%E%N% %P%R%E%S%S% %A%N%Y% %K%E%Y"
8060 IF INKEY$="" THEN GOTO 8060
8070 SAVE Z$
8075 SLOW 
8080 GOTO OA
9999 STOP 

People

No people associated with this content.

Scroll to Top