Google
 

Trailing-Edge - PDP-10 Archives - decus_20tap1_198111 - decus/20-0020/correl.sta
There are 2 other files named correl.sta in the archive. Click here to see a list.
100'  NAME--CORREL
110'
120'  DESCRIPTION--COMPUTES A CORRELATION COEFFICIENT
130'
140'  SOURCE--UNKNOWN
150'
160'  INSTRUCTIONS--THE DATA CONSISTS OF N SETS OF NUMBERS.
170'  EACH SET CONSISTS OF TWO ELEMENTS, X AND Y.  N IS
180'  ENTERED AS DATA IN LINE 900.  IN LINE 910 AND FOLLOWING
190'  ENTER DATA ALTERNATING X AND Y VALUES.  SAMPLE DATA
200'  ARE IN LINES 900-910.
210'
220'  *  *  *  *  *  *    MAIN PROGRAM  *  *  *  *  *  *  *  *  *
230'
240'
250 READ N
260 FOR I = 1 TO N
270 READ X, Y
280 LET S1 = S1 + X
290 LET S2 = S2 + Y
300 LET S3 = S3 + X*Y
310 LET S4 = S4 + X*X
320 LET S5 = S5 + Y*Y
330 NEXT I
340 PRINT "THE CORRELATION COEFFICIENT = ";
350 LET A = N*S3 - S1*S2
360 LET B = SQR((N*S4 - S1^2)*(N*S5 - S2^2))
370 LET A = INT(A/B*1000+.5)/1000
380 PRINT A
900 DATA 5
910 DATA 1,5,2,3,3,0,4,-5,5,-11
99999 END