PROGRAM d13r13(input,output,dfile); (* driver for routine CNTAB1 *) (* contingency table in file TABLE1.DAT *) CONST ndat=9; nmon=12; TYPE narray = ARRAY [1..ndat,1..nmon] OF integer; chr15 = string[15]; chr5 = string[5]; VAR ccc,chisq,cramrv,df,prob : real; i,j : integer; nmbr : narray; fate : ARRAY [1..ndat] OF chr15; mon : ARRAY [1..nmon] OF chr5; txt : string[64]; dfile : text; (*$I MODFILE.PAS *) (*$I GAMMLN.PAS *) (*$I GCF.PAS *) (*$I GSER.PAS *) (*$I GAMMQ.PAS *) (*$I CNTAB1.PAS *) BEGIN glopen(dfile,'table1.dat'); readln(dfile); readln(dfile,txt); read(dfile,fate[1]); FOR i := 1 to 12 DO read(dfile,mon[i]); readln(dfile); readln(dfile); FOR i := 1 to ndat DO BEGIN read(dfile,fate[i]); FOR j := 1 to 12 DO read(dfile,nmbr[i,j]); readln(dfile) END; close(dfile); writeln; writeln(txt); writeln; write(' ':15); FOR i := 1 to 12 DO write(mon[i]:5); writeln; FOR i := 1 to ndat DO BEGIN write(fate[i]); FOR j := 1 to 12 DO write(nmbr[i,j]:5); writeln END; cntab1(nmbr,ndat,nmon,chisq,df,prob,cramrv,ccc); writeln; writeln('chi-squared ',chisq:20:2); writeln('degrees of freedom',df:20:2); writeln('probability ',prob:20:4); writeln('cramer-v ',cramrv:20:4); writeln('contingency coeff.',ccc:20:4) END.