PROGRAM d13r14(input,output,dfile); (* driver for routine CNTAB2 *) (* contingency table in file TABLE1.DAT *) CONST ni=9; nmon=12; TYPE narray = ARRAY [1..ni,1..nmon] OF integer; chr5 = string[5]; chr15 = string[15]; VAR h,hx,hxgy,hy,hygx : real; uxgy,uxy,uygx : real; i,j : integer; nmbr : narray; fate : ARRAY [1..ni] OF chr15; mon : ARRAY [1..nmon] OF chr5; txt : string[64]; dfile : text; (*$I MODFILE.PAS *) (*$I CNTAB2.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 ni 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 ni DO BEGIN write(fate[i]); FOR j := 1 to 12 DO write(nmbr[i,j]:5); writeln END; cntab2(nmbr,ni,nmon,h,hx,hy,hygx,hxgy,uygx,uxgy,uxy); writeln; writeln('entropy of table ',h:10:4); writeln('entropy of x-distribution ',hx:10:4); writeln('entropy of y-distribution ',hy:10:4); writeln('entropy of y given x ',hygx:10:4); writeln('entropy of x given y ',hxgy:10:4); writeln('dependency of y on x ',uygx:10:4); writeln('dependency of x on y ',uxgy:10:4); writeln('symmetrical dependency ',uxy:10:4) END.