相关代码 |
|
procedure CHSTWO(BINS1, BINS2:array of real; NBINS, KNSTRN:integer;var DF, CHSQ, PROB:real); var J:integer; begin DF:=NBINS - 1 - KNSTRN; CHSQ:=0; For J:=1 To NBINS do begin If (BINS1[J] = 0) And (BINS2[J] = 0) Then DF:=DF - 1 Else CHSQ:=CHSQ + Sqr(BINS1[J] - BINS2[J]) / (BINS1[J] + BINS2[J]); end; PROB:=GAMMQ(0.5 * DF, 0.5 * CHSQ); end;