Trailing-Edge
-
PDP-10 Archives
-
decuslib10-01
-
43,50110/stat12.sta
There are 2 other files named stat12.sta in the archive. Click here to see a list.
100' NAME--STAT12
110'
120' DESCRIPTION--COMPUTES THE CORRELATION MATRIX FOR N SERIES OF DATA.
130'
140' SOURCE--UNKNOWN
150'
160' INSTRUCTIONS--ENTER DATASTARTING IN LINE 900 IN THE
170' FOLLOWING ORDER: 1) THE NUMBER OF SERIES, 2) THE NUMBER
180' IN EACH SERIES, 3) THEN THE DATA BY GROUP(NOT BY SERIES).
190' THIS PROGRAM IS LIMITED TO 25 SERIES, WITH AN ARBITRARY
200' NUMBER IN EACH SERIES. TO INCREASE THE MAXIMUM NUMBER OF
210' SERIES, CHANGE THE DIM STATEMENTS IN LINE 270.
220' SAMPLE DATA ARE IN LINES 900 THROUGH 1050.
230'
240'
250' * * * * * * MAIN PROGRAM * * * * * * * * * *
260'
270 DIM S(25,25),D(25),X(25)
280 READ N, M
290 LET X(0) = 1
300 FOR K = 1 TO M
310 FOR I = 1 TO N
320 READ X(I)
330 NEXT I
340 FOR I = 0 TO N
350 FOR J = I TO N
360 LET S(I,J) = S(I,J) + X(I)*X(J)
370 NEXT J
380 NEXT I
390 NEXT K
400 REM HAVING COMPUTED THE SUM-OF-SQUARES MATRIX, WE CONTINUE.
410 PRINT "VARIABLE ", "MEAN ", "VARIANCE ", "STD. DEV."
420 FOR I = 1 TO N
430 LET M1 = S(0,I) / M
440 LET Q = ( M * S(I,I) -S(0,I)*S(0,I) ) / M / (M-1)
450 LET D(I) = SQR(Q)
460 PRINT I, M1, Q, D(I)
470 NEXT I
480 REM NOW WE PRODUCE AND PRINT THE CORRELATION MATRIX...
490 PRINT
500 PRINT "THE CORRELATION MATRIX"
510 PRINT
520 FOR I = 1 TO N
530 FOR J = 1 TO I-1
540 PRINT " ",
550 NEXT J
560 FOR J = I TO N
570 PRINT (M*S(I,J) - S(0,I)*S(0,J))/M/(M-1)/D(I)/D(J),
580 NEXT J
590 PRINT
600 PRINT
610 NEXT I
620 STOP
900 DATA 4, 15
910 DATA 32, 48, 54, 15
920 DATA 36, 33, 19, 16
930 DATA 3, 28, 30, 14
940 DATA 12, 33, 64, 22
950 DATA 36, 34, 60, 24
960 DATA 24, 36, 53, 19
970 DATA 19, 42, 29, 13
980 DATA 20, 33, 55, 15
990 DATA 27, 36, 62, 23
1000 DATA 15, 22, 33, 12
1010 DATA 45, 46, 68, 25
1020 DATA 9, 28, 42, 17
1030 DATA 11, 32, 45, 18
1040 DATA 33, 34, 39, 19
1050 DATA 21, 45, 39, 18
1060END