Trailing-Edge
-
PDP-10 Archives
-
decuslib20-01
-
decus/20-0020/stat10.sta
There are 2 other files named stat10.sta in the archive. Click here to see a list.
100' NAME--STAT10
110'
120' DESCRIPTION--COMPUTES THE SLOPE AND OTHER STATISTICS FOR A
130' SIMPLE LINEAR REGRESSION WITH ONE INDEPENDENT VARIABLE
140'
150' SOURCE--UNKNOWN
160'
170' INSTRUCTIONS--PUT DATA IN LINE 900 AND FOLLOWING.
180' FIRST DATA IS N, THE NUMBER OF POINTS, THEN THE DATA
190' BY POINT(NOT BY SERIES).
200' SAMPLE DATA ARE IN LINES 900 THROUGH 950.
210'
220'
230' * * * * * * MAIN PROGRAM * * * * * * * * * * *
240'
250 READ N
260 FOR I = 1 TO N
270 READ X,Y
280 LET X1 = X1 + X
290 LET Y1 = Y1 + Y
300 LET X2 = X2 + X*X
310 LET Y2 = Y2 + Y*Y
320 LET Z = Z + X*Y
330 NEXT I
340 LET S1 = N*X2 - X1*X1
350 LET S2 = N*Z - X1*Y1
360 LET B = S2/S1
370 LET Y3 = Y1/N
380 LET X3 = X1/N
390 LET B1 = Y3 - B*X3
400 LET N1 = N - 1
410 LET N2 = N1 - 1
420 LET S3 = (Y2 - Y1*Y3 - B*S2/N)
430 LET S4 = S3/N2
440 PRINT "NUMBER = "N, "SLOPE = "B
450 PRINT "MEAN OF X = "X1/N, "OF Y = "Y1/N
460 PRINT "Y-INTERCEPT = "B1
470 PRINT "SUM-OF-SQUARES","TOTAL", Y2
480 PRINT " ", "MEAN", Y3*Y1
490 PRINT " ", "SLOPE", B*S2/N
500 PRINT " ", "RESIDUAL", S3
510 PRINT "STANDARD DEVIATIONS"
520 PRINT " ", "X ", SQR(S1/N/N1)
530 PRINT " ", "Y ", SQR((Y2 - Y1*Y3)/N1)
540 PRINT " ", "ERROR", SQR(S4)
550 PRINT " ", "Y-BAR", SQR(S4/N)
560 PRINT " ", "SLOPE", SQR(S4/S1*N)
570 PRINT "F-RATIO FOR SLOPE = " B*S2/N/S4
580 STOP
900 DATA 5
910 DATA 480, 56
920 DATA 500, 61
930 DATA 520, 78
940 DATA 540, 71
950 DATA 560, 82
960END