10 PRINT "LINEAR REGRESSION"
20 PRINT
30 PRINT "NUMBER OF KNOWN POINTS";
40 INPUT N
50 J=0
60 K=0
70 L=0
80 M=0
90 R2=0
99 REM -LOOP TO ENTER COORDINATES OF POINTS
100 FOR I=1 TO N
110 PRINT "X,Y OF POINT";I;
120 INPUT X,Y
129 REM - ACCUMULATE INTERMEDIATE SUMS
130 J=J+X
140 K=K+Y
150 L=L+X[2
160 M=M+Y[2
170 R2=R2+X*Y
180 NEXT I
189 REM - COMPUTE CURVE COEFFICIENT
190 B=(N*R2-K*J)/(N*L-J[2)
200 A=(K-B*J)/N
210 PRINT
220 PRINT "F(X) =";A;"+ (";B;"* x )"
229 REM - COMPUTE REGRESSION ANALYSIS
230 J=B*(R2-J*K/N)
240 M=M-K[2/N
250 K=M-J
260 PRINT
270 R2=J/M
280 PRINT "COEFFICIENT OF DETERMINATION (R[2) =";R2
290 PRINT "COEFFICIENT OF CORRELATION =";SQR(R2)
300 PRINT "STANDARD ERROR OF ESTIMATE =";SQR(K/(N-2))
310 PRINT
319 REM - ESTIMATE Y-COORDINATES OF POINTS WITH ENTERED X-COORDINATES
320 PRINT "INTERPOLATION:  (ENTER X=0 TO END PROGRAM)"
330 PRINT"X =";
340 INPUT X
349 REM - RESTART OR END PROGRAM?
350 IF X=0 THEN 390
360 PRINT "Y =";A+B*X
370 PRINT
380 GOTO 330
390 END
