home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Best of German Only 2
/
romside_best_of_german_only_2.iso
/
dos
/
anwender
/
ed
/
eng
/
linb0.bas
< prev
next >
Wrap
BASIC Source File
|
1993-04-13
|
4KB
|
166 lines
10 REM X,Y-PAIRS INTO THE DATAS
20 DATA ,
30 DATA ,
40 DATA ,
50 DATA ,
60 DATA ,
70 DATA ,
80 DATA ,
90 DATA ,
100 DATA ,
110 DATA ,
120 DATA ,
130 DATA ,
140 DATA ,
150 DATA ,
160 DATA ,
170 DATA ,
180 DATA ,
190 DATA ,
200 DATA ,
210 DATA ,
220 DATA ,
230 DATA ,
240 DATA ,
250 DATA ,
260 DATA ,
270 DATA ,
280 DATA ,
290 DATA ,
300 DATA ,
310 DATA ,
320 DATA ,
330 DATA ,
340 DATA ,
350 DATA ,
360 DATA ,
370 DATA ,
380 DATA ,
390 DATA ,
400 DATA ,
410 DATA ,
420 DATA ,
430 DATA ,
440 DATA ,
450 DATA ,
460 DATA ,
470 DATA ,
480 DATA ,
490 DATA ,
500 DATA ,
510 DATA ,
520 DATA ,
530 DATA ,
540 DATA ,
550 DATA ,
560 DATA ,
570 DATA ,
580 DATA ,
590 DATA ,
600 DATA ,
610 DATA ,
620 REM WRITTEN BY (APRIL 1988 / 1993)
630 REM KLAUS D. WLOCZYK
640 REM OTTO-HAHN-STRASSE 7
650 REM D-63517 RODENBACH
660 REM GERMANY
670 REM THIS PROGRAM IS IN THE PUBLIC DOMAIN. VERSION FOR GW-BASIC 3.20
680 SCREEN 0,0,0,0:WIDTH 80:CLS
690 WIDTH LPRINT 80
700 DEFINT I
710 DEFSNG A-H,J-Z
720 PRINT "LINEARE REGRESSION."
730 PRINT "INTOP IS TO BE ZERO (Y = MX)."
740 PRINT
750 PRINT "NUMBER OF X,Y-PAIRS?"
760 INPUT "(MIN 2, MAX 60) < ",N
770 IF N>60 OR N<2 THEN 750
780 PRINT
790 PRINT "CALCULATING ...";
800 DIM X(60),Y(60)
810 S1=0
820 S2=0
830 S3=0
840 S4=0
850 S5=0
860 S6=0
870 S7=0
880 T=0
890 FOR I=1 TO N
900 READ X(I),Y(I)
910 S1=S1+X(I)
920 S2=S2+Y(I)
930 S3=S3+X(I)*Y(I)
940 S4=S4+X(I)*X(I)
950 T=T+Y(I)*Y(I)
960 NEXT I
970 M1=S1/N
980 M2=S2/N
990 M=S3/S4
1000 S5=S4-(S1*S1)/N
1010 S6=T-(S2*S2)/N
1020 S5=SQR(S5/(N-1))
1030 S6=SQR(S6/(N-1))
1040 S7=T-M*S3
1050 S8=S7/S4/(N-1)
1060 S8=SQR(S8)
1070 PRINT
1080 PRINT "PRINT(0) OR LPRINT(1)?"
1090 INPUT "(LPRINT IS STILL POSSIBLE AFTER PRINT) < ",ISW
1100 PRINT
1110 IF ISW<>0 AND ISW<>1 THEN GOTO 1080
1120 IF ISW=1 THEN GOTO 1370
1130 PRINT
1140 PRINT "SLOPE M =";M
1150 PRINT "SIGMA M =";S8
1160 PRINT
1170 PRINT "SUM X =";S1
1180 PRINT "SUM Y =";S2
1190 PRINT "MEAN VALUE X =";M1
1200 PRINT "MEAN VALUE Y =";M2
1210 PRINT "SIGMA X =";S5
1220 PRINT "SIGMA Y =";S6
1230 PRINT
1240 PRINT "SUM X^2 =";S4
1250 PRINT "SUM Y^2 =";T
1260 PRINT "SUM X*Y =";S3
1270 PRINT "SUM (Y-Y')^2 =";S7
1280 PRINT
1290 PRINT " NO. X Y Y' Y'-Y"
1300 PRINT
1310 FOR I=1 TO N
1320 A=M*X(I)
1330 D=Y(I)-A
1340 PRINT SPACE$(3-LEN(STR$(I)));STR$(I);" ";STR$(X(I));SPACE$(14-LEN(STR$(X(I))));STR$(Y(I));SPACE$(14-LEN(STR$(Y(I))));STR$(A);SPACE$(25-LEN(STR$(A)));STR$(D)
1350 NEXT I
1360 GOTO 1070
1370 LPRINT
1380 LPRINT "SLOPE M =";M
1390 LPRINT "SIGMA M =";S8
1400 LPRINT
1410 LPRINT "SUM X =";S1
1420 LPRINT "SUM Y =";S2
1430 LPRINT "MEAN VALUE X =";M1
1440 LPRINT "MEAN VALUE Y =";M2
1450 LPRINT "SIGMA X =";S5
1460 LPRINT "SIGMA Y =";S6
1470 LPRINT
1480 LPRINT "SUM X^2 =";S4
1490 LPRINT "SUM Y^2 =";T
1500 LPRINT "SUM X*Y =";S3
1510 LPRINT "SUM (Y-Y')^2 =";S7
1520 LPRINT
1530 LPRINT
1540 LPRINT " NO. X Y Y' Y'-Y"
1550 LPRINT
1560 IPR=19
1570 FOR I=1 TO N
1580 IPR=IPR+1
1590 IF IPR>32 THEN INPUT "INSERT NEW SHEET OF PAPER, THEN PRESS RETURN < ",W$:IPR=1
1600 A=M*X(I)
1610 D=Y(I)-A
1620 LPRINT SPACE$(3-LEN(STR$(I)));STR$(I);" ";STR$(X(I));SPACE$(14-LEN(STR$(X(I))));STR$(Y(I));SPACE$(14-LEN(STR$(Y(I))));STR$(A);SPACE$(25-LEN(STR$(A)));STR$(D)
1630 NEXT I
1640 GOTO 1070
1650 END