Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap1_198111 - decus/20-0020/stat9.sta
There are 2 other files named stat9.sta in the archive. Click here to see a list.
100'  NAME--STAT9+
110'
120'  DESCRIPTION--COMPUTES THE SLOPE AND OTHER STATISTICS FOR A
130'  LINEAR REGRESSION WITH SEVERAL Y VALUES FOR EACH X VALUE.
140'
150'  SOURCE--UNKNOWN
160'
170'  INSTRUCTIONS--PUT DATA STARTING IN LINE 900.
180'  FIRST DATA IS K, THE NUMBER OF DIFFERENT X-VALUES. THEN
190'  FOR EACH OF THE K GROUPS-ENTER THE NUMBER IN THAT GROUP,
200'  THEN THE COMMON X-VALUE, THEN THE Y-VLAUES FOR THAT GROUP.
210'  SAMPLE DATA ARE IN LINES 900-950.
220'
230'
240'  *  *  *  *  *  *  MAIN PROGRAM  *  *  *  *  *  *  *  *  *
250  READ K
260  FOR J = 1 TO K
270   READ N0
280   LET N=N+N0
290   READ X
300   FOR I = 1 TO N0
310    READ Y
320    LET X1 = X1 + X
330   LET Y1 = Y1 + Y
340   LET X2 = X2 + X*X
350   LET Y2 = Y2 + Y*Y
360   LET Z = Z + X*Y
370  NEXT I
380 NEXT J
390 LET S1 = N*X2 - X1*X1
400 LET S2 = N*Z - X1*Y1
410 LET B = S2/S1
420 LET Y3 = Y1/N
430 LET X3 = X1/N
440 LET B1 = Y3 - B*X3
450 LET N1 = N - 1
460 LET N2 = N1 - 1
470 LET S3 = (Y2 - Y1*Y3 - B*S2/N)
480 LET S4 = S3/N2
490 PRINT "NUMBER = "; N, "SLOPE = ";B
500 PRINT "MEAN OF X = "; X1/N, "  OF Y = "; Y1/N
510 PRINT "Y-INTERCEPT = "B1
520 PRINT "SUM-OF-SQUARES", "TOTAL",Y2
530 PRINT "   ", "MEAN  ", Y3*Y1
540 PRINT "   ", "SLOPE ", B*S2/N
550 PRINT "   ", "RESIDUAL ", S3
560 PRINT "STANDARD DEVIATIONS"
570 PRINT "   ", "X  ", SQR(S1/N/N1)
580 PRINT "   ", "Y  ", SQR((Y2-Y1*Y3)/N1)
590 PRINT "   ", "ERROR ", SQR(S4)
600 PRINT "   ", "Y-BAR ", SQR(S4/N)
610 PRINT "   ", "SLOPE ", SQR(S4/S1*N)
620 PRINT "   ", "Y-INTER.", SQR(S4*(1/N + X3*X3/S1*N))
630 PRINT "F-RATIO FOR SLOPE = " B*S2/N/S4
640 STOP
900 DATA  5
910 DATA 3, 4, 6, 8, 7
920 DATA 2, 7, 1, 3
930 DATA 5, 6, 1, 2, 3, 4, 5
940 DATA 1, 1, 2
950 DATA 4, 5, 2, 4, 6, 8, 10
960 END