home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Education
/
collectionofeducationcarat1997.iso
/
SCIENCE
/
MATHPAK2.ZIP
/
REGRESS.BAS
< prev
Wrap
BASIC Source File
|
1986-10-07
|
2KB
|
63 lines
100 CLS
110 A$=STRING$(80,205)
120 PRINT A$
130 PRINT TAB(27)"REGRESSION ANALYSIS #3001"
140 COLOR 23
150 PRINT :PRINT :PRINT TAB(39)"IPCO"
160 COLOR 7
170 PRINT :PRINT :PRINT TAB(25)"THE PERSONAL COMPUTER OWNERS GROUP"
180 PRINT :PRINT :PRINT TAB(19)"p.o. box 10426, pittsburgh,pennsylvania 15234"
190 PRINT A$
200 PRINT :PRINT :PRINT :PRINT :PRINT
210 PRINT TAB(28)"PRESS ANY KEY TO CONTINUE"
220 A$=INKEY$:IF A$="" THEN 220
230 CLS
240 CLS
250 PRINT TAB(30)"LINEAR REGRESSION":PRINT :PRINT
260 INPUT "NUMBER OF KNOWN POINTS";N
270 J=0
280 K=0
290 L=0
300 M=0
310 R2=0
320 REM LOOP TO ENTER COORDINATES OF POINTS
330 FOR I=1 TO N
340 PRINT "X,Y OF POINT ";I;
350 INPUT X,Y
360 REM ACCUMULAT INTERMEDIATE SUMS
370 J=J+X
380 K=K+Y
390 L=L+X^2
400 M=M+Y^2
410 R2=R2+X*Y
420 NEXT I
430 B=(N*R2-K*J)/(N*L-J^2)
440 A=(K-B*J)/N
450 PRINT
460 PRINT "F(X)=";A;"+(";B;"*X)"
470 REM COMPUTE REGRESSION ANALYSIS
480 J=B*(R2-J*K/N)
490 M=M-K^2/N
500 K=M-J
510 PRINT
520 R2=J/M
530 PRINT "COEFFICIENT OF DETERMINATION (R^2)=";R2
540 PRINT "COEFFICIENT OF CORRELATION= ";SQR(R2)
550 PRINT "STANDARD ERROR OF ESTIMATE=";SQR(K/(N-2))
560 PRINT
570 REM ESTIMATE Y-COORDINATES OF POINTS WITH ENTERED X-COORDINATES
580 PRINT "INTERPOLATION:(ENTER X=0 TO END PROGRAM)"
590 PRINT "X=";
600 INPUT X
610 REM RESTART OR END PROGRAM
620 IF X=0 THEN 660
630 PRINT "Y=";A+B*X
640 PRINT
650 GOTO 590
660 END
=";
600 INPUT X
610 REM RESTART OR END PROGRAM
620 IF X=0 THEN 660
630 PRINT "Y=";A+B*X
640