1 5 REM ---STAT12---OCT 27, 1969
 2 10   REM  DESCRIPTION: COMPUTES THE CORRELATION MATRIX FOR N
 3 20   REM  SERIES OF DATA.
 4 40   REM  INSTRUCTIONS: ENTER DATA STARTING IN LINE 900 IN THE
 5 50   REM  FOLLOWING ORDER:  1) THE NUMBER OF SERIES, 2) THE NUMBER
 6 60   REM  IN EACH SERIES, 3) THEN THE DATA BY GROUP (NOT BY SERIES).
 7 70   REM  THIS PROGRAM IS LIMITED TO 25 SERIES, WITH AN ARBITRARY
 8 75   REM  NUMBER IN EACH SERIES.  TO INCREASE THE MAXIMUM NUMBER OF
 9 80  REM  SERIES, CHANGE THE DIM STATEMENTS IN LINE 100.
10 90  READ O0
11 91  RESET
12 92  IF O0 <> 999999 THEN 100
13 93  PRINT "LIST LINES 10 TO 85 FOR INSTRUCTIONS"
14 94 STOP
15 100 DIM S(25,25),D(25),X(25)
16 110  READ N, M
17 170  LET X(0) = 1
18 200  FOR K = 1 TO M
19 210  FOR I = 1 TO N
20 220  READ X(I)
21 230  NEXT I
22 240  FOR I = 0 TO N
23 250  FOR J = I TO N
24 260  LET S(I,J) = S(I,J) + X(I)*X(J)
25 270  NEXT J
26 280  NEXT I
27 290  NEXT K
28 300  REM HAVING COMPUTED THE SUM-OF-SQUARES MATRIX, WE CONTINUE.
29 305  PRINT TAB(3);"VARIABLE";TAB(23);"MEAN";TAB(34);"VARIANCE";
30 306  PRINT TAB(48);"STD. DEV."
31 310  FOR I = 1 TO N
32 320  LET M1 = S(0,I) / M
33 330  LET Q = ( M * S(I,I) -S(0,I)*S(0,I) ) / M / (M-1)
34 340  LET D(I) = SQR(Q)
35 350  PRINT I, M1, Q, D(I)
36 360  NEXT I
37 600  REM NOW WE PRODUCE AND PRINT THE CORRELATION MATRIX...
38 605  PRINT
39 610  PRINT "THE CORRELATION MATRIX"
40 620  PRINT
41 630  FOR I = 1 TO N
42 635 IF I = 1 THEN 670
43 640  FOR J = 1 TO I-1
44 650 PRINT " ",
45 660  NEXT J
46 670  FOR J = I TO N
47 680  PRINT (M*S(I,J) - S(0,I)*S(0,J))/M/(M-1)/D(I)/D(J),
48 690  NEXT J
49 700  PRINT
50 710  PRINT
51 720  NEXT I
52 730  STOP
53 900 DATA 999999
54 9999 END