Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-01 - 43,50110/stat05.sta
There are 2 other files named stat05.sta in the archive. Click here to see a list.
100'  NAME--STAT05
110'
120'  DESCRIPTION--COMPUTES CHI SQUARE STATISTICS FOR ANY
130'  NUMBER OF M BY N CONTINGENCY TABLES.
140'
150'  SOURCE--UNKNOWN
160'
170'  INSTRUCTIONS--PUT DATA IN LINE 900 AND FOLLOWING.
180'  DATA LINE NUMBERS SHOULD NOT EXCEED 909. FIRST ENTER M,
190'  THE NUMBER  OF ROWS, THEN N,THE NUMBER OF COLUMNS. THEN
200'  ENTER THE DATA FOR TABLE 1 BY ROWS, THEN THE DATA FOR THE
210'  THE SECOND TABLE, ETC. M AND N SHOULD NOT EXCEED 10.
220'  SAMPLE DATA ARE IN LINE 900
230'
240'
250'  *  *  *  *  *  *   MAIN PROGRAM   *  *  *  *  *  *  *  *  *  *  *
260'
270  READ M, N
280  FOR I = 1 TO M
290  LET S = 0
300  FOR J = 1 TO N
310  READ O(I,J)
320  LET S = S + O(I,J)
330  NEXT J
340  LET R(I) = S
350  NEXT I
360  LET S1 = 0
370  FOR J = 1 TO N
380  LET S = 0
390  FOR I = 1 TO M
400  LET S = S + O(I,J)
410  NEXT I
420  LET C(J) = S
430  LET S1 = S1 + S
440  NEXT J
450  LET C = 0
460  PRINT
470  FOR I = 1 TO M
480  FOR J = 1 TO N
490  LET E = R(I) * C(J) / S1
500  LET O = O(I,J)
510  LET C = C + (O - E)*(O - E)/E
520  PRINT O,
530  NEXT J
540  PRINT
550  NEXT I
560  PRINT "CHI-SQUARE EQUALS"; C; "ON"; (M-1)*(N-1);"DEGREES OF FREEDOM."
570  GO TO 280
900  DATA  3, 2, 15, 21, 76, 51, 21, 9
910  END