-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcntab1.dem
26 lines (26 loc) · 837 Bytes
/
cntab1.dem
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
PROGRAM D13R13
C Driver for routine CNTAB1
C Contingency table in file TABLE.DAT
PARAMETER(NDAT=9,NMON=12)
DIMENSION NMBR(NDAT,NMON)
CHARACTER FATE(NDAT)*15,MON(NMON)*5,TEXT*64
OPEN(5,FILE='TABLE.DAT',STATUS='OLD')
READ(5,*)
READ(5,'(A)') TEXT
READ(5,'(15X,12A5/)') (MON(I),I=1,12)
DO 11 I=1,NDAT
READ(5,'(A15,12I5)') FATE(I),(NMBR(I,J),J=1,12)
11 CONTINUE
CLOSE(5)
WRITE(*,'(/1X,A/)') TEXT
WRITE(*,'(1X,15X,12A5)') (MON(I),I=1,12)
DO 12 I=1,NDAT
WRITE(*,'(1X,A,12I5)') FATE(I),(NMBR(I,J),J=1,12)
12 CONTINUE
CALL CNTAB1(NMBR,NDAT,NMON,CHISQ,DF,PROB,CRAMRV,CCC)
WRITE(*,'(/1X,A,T20,F20.2)') 'Chi-squared',CHISQ
WRITE(*,'(1X,A,T20,F20.2)') 'Degrees of Freedom',DF
WRITE(*,'(1X,A,T20,F20.4)') 'Probability',PROB
WRITE(*,'(1X,A,T20,F20.4)') 'Cramer-V',CRAMRV
WRITE(*,'(1X,A,T20,F20.4)') 'Contingency Coeff.',CCC
END