Web pdp-10.trailing-edge.com

Trailing-Edge - PDP-10 Archives - decuslib20-01 - decus/20-0020/stat08.sta
There are 2 other files named stat08.sta in the archive. Click here to see a list.
```100'  NAME--STAT08
110'
120'  DESCRIPTION--COMPARES TWO GROUPS OF DATA USING THE MEDIAN TEST.
130'
140'  SOURCE--UNKNOWN
150'
160'  INSTRUCTIONS--PUT DATA IN LINE 900 AND FOLLOWING.
170'  THE FIRST DATUM IS THE NUMBER OF ENTRIES IN THE FIRST
180'  GROUP, THEN ENTER THE NUMBER OF ENTRIES IN THE SECOND GROUP,
190'  THEN THE FIRST GROUP ITSELF IS ENTERED,AND THEN THE SECOND GROUP.
200'  THE PROGRAM PRINTS OUT THE CHI SQUARE STATISTIC OF A 2 BY 2 TABLE
210'  ON 1 DEGREE OF FREEDOM.
220'  SAMPLE DATA IS IN LINE 900.
230'
240'
250'  *  *  *  *  *  *     MAIN PROGRAM   *  *  *  *  *  *  *  *  *  *
260'
280  LET M1 = M + N
290  LET M2 = INT( M1/2 )
310  LET L = 1
320  LET U = M
330  GOSUB 630
340  LET L = M + 1
350  LET U = M1
360  GOSUB 630
370  LET X = Y = 0
380  LET I = 1
390  LET J = M + 1
400  FOR K = 1 TO M2
410     IF A(I) < A(J) THEN 470
420     LET Y = Y + 1
430     LET J = J + 1
440     IF J <= M1 THEN 520
450     LET X = M2 - Y
460     GO TO 530
470     LET X = X + 1
480     LET I = I + 1
490     IF I <= M THEN 520
500     LET Y = M2 - X
510     GO TO 530
520  NEXT K
530  LET U = M - X
540  LET V = N - Y
550  LET Z = X*V - Y*U
560  LET T = M1*( ABS(Z) - M1/2 ) ^ 2
570  LET C2 = T / M / N / M2 / (M1 - M2)
580    PRINT "TWO SAMPLE MEDIAN TEST."
590    PRINT "GROUP 1  "; X; U
600    PRINT "GROUP 2  "; Y; V
610    PRINT "CHI-SQUARE = "; C2
620  STOP
630  FOR I = 1 TO U - L
640     LET X = A(L)
650     LET Q = L
660     FOR J = L + 1 TO U - I + 1
670        IF X >= A(J) THEN 700
680        LET X = A(J)
690        LET Q = J
700     NEXT J
710     IF J = Q THEN 740
720     LET A(Q) = A(J)
730     LET A(J) = X
740  NEXT I
750  RETURN
900  DATA  4, 6, 160, 160, 140, 190, 117, 145, 147, 120, 150, 120
910END

```