home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Best of German Only 2
/
romside_best_of_german_only_2.iso
/
dos
/
anwender
/
ed
/
deu
/
linreg.bas
< prev
next >
Wrap
BASIC Source File
|
1993-04-13
|
4KB
|
177 lines
10 REM WERTEPAARE IN DEN 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 GESCHRIEBEN VON (1980 / 1993)
630 REM KLAUS D. WLOCZYK
640 REM OTTO-HAHN-STRASSE 7
650 REM D-63517 RODENBACH
660 REM GERMANY
670 REM DIESES PROGRAMM IST IN DER PUBLIC DOMAIN. VERSION FUER 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 (Y = MX + B)."
730 PRINT
740 PRINT "ANZAHL DER WERTEPAARE?"
750 INPUT "(MIN 3, MAX 60) < ",N
760 IF N>60 OR N<3 THEN 740
770 PRINT "RECHNUNG ...";
780 DIM X(60),Y(60)
790 S1=0
800 S2=0
810 S3=0
820 S4=0
830 S5=0
840 S6=0
850 S7=0
860 T=0
870 FOR I=1 TO N
880 READ X(I),Y(I)
890 S1=S1+X(I)
900 S2=S2+Y(I)
910 S3=S3+X(I)*Y(I)
920 S4=S4+X(I)*X(I)
930 T=T+Y(I)*Y(I)
940 NEXT I
950 M1=S1/N
960 M2=S2/N
970 M=(S3-S1*S2/N)/(S4-(S1*S1)/N)
980 B=(S2-M*S1)/N
990 S5=S4-(S1*S1)/N
1000 S6=T-(S2*S2)/N
1010 S5=SQR(S5/(N-1))
1020 S6=SQR(S6/(N-1))
1030 R=M*S5/S6
1040 S7=T-M*S3-B*S2
1050 S8=N*S7/((N-2)*(N*S4-(S1*S1)))
1060 S8=SQR(S8)
1070 S9=S4*S7/((N-2)*(N*S4-(S1*S1)))
1080 S9=SQR(S9)
1090 PRINT
1100 PRINT "PRINT(0) ODER LPRINT(1)?"
1110 INPUT "(LPRINT NACH PRINT NOCH MOEGLICH) < ",ISW
1120 PRINT
1130 IF ISW<>0 AND ISW<>1 THEN GOTO 1100
1140 IF ISW=1 THEN GOTO 1430
1150 PRINT
1160 PRINT "STEIGUNG M =";M
1170 PRINT
1180 PRINT "ACHSENABSCHNITT B =";B
1190 PRINT
1200 PRINT "KORRELATIONSKOEFFIZIENT R =";R
1210 PRINT "SIGMA M =";S8
1220 PRINT "SIGMA B =";S9
1230 PRINT "SUMME X =";S1
1240 PRINT "SUMME Y =";S2
1250 PRINT "MITTELWERT X =";M1
1260 PRINT "MITTELWERT Y =";M2
1270 PRINT "SIGMA X =";S5
1280 PRINT "SIGMA Y =";S6
1290 PRINT
1300 PRINT "SUMME X^2 =";S4
1310 PRINT "SUMME Y^2 =";T
1320 PRINT "SUMME X*Y =";S3
1330 PRINT "SUMME (Y-Y')^2 =";S7
1340 PRINT
1350 PRINT " NR. X Y Y' Y'-Y"
1360 PRINT
1370 FOR I=1 TO N
1380 A=M*X(I)+B
1390 D=Y(I)-A
1400 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)
1410 NEXT I
1420 GOTO 1090
1430 LPRINT
1440 LPRINT "STEIGUNG M =";M
1450 LPRINT
1460 LPRINT "ACHSENABSCHNITT B =";B
1470 LPRINT
1480 LPRINT "KORRELATIONSKOEFFIZIENT R =";R
1490 LPRINT "SIGMA M =";S8
1500 LPRINT "SIGMA B =";S9
1510 LPRINT
1520 LPRINT "SUMME X =";S1
1530 LPRINT "SUMME Y =";S2
1540 LPRINT "MITTELWERT X =";M1
1550 LPRINT "MITTELWERT Y =";M2
1560 LPRINT "SIGMA X =";S5
1570 LPRINT "SIGMA Y =";S6
1580 LPRINT
1590 LPRINT "SUMME X^2 =";S4
1600 LPRINT "SUMME Y^2 =";T
1610 LPRINT "SUMME X*Y =";S3
1620 LPRINT "SUMME (Y-Y')^2 =";S7
1630 LPRINT
1640 LPRINT
1650 LPRINT " NR. X Y Y' Y'-Y"
1660 LPRINT
1670 IPR=24
1680 FOR I=1 TO N
1690 IPR=IPR+1
1700 IF IPR>32 THEN INPUT "NEUES BLATT EINLEGEN, DANN ENTER DRUECKEN < ",W$:IPR=1
1710 A=M*X(I)+B
1720 D=Y(I)-A
1730 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)
1740 NEXT I
1750 GOTO 1090
1760 END