The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



Chi2OfContTabYates


Unit: SDL_statis
Class: none
Declaration: function Chi2OfContTabYates (ContTab: TInt2DArray; var chisq, p: double): integer;

The function Chi2OfContTabYates calculates the chi-square value for a given 2x2 contingency table. The chi-square value is calculated using Yates's continuity correction (which should always be applied for 2x2 contingency tables). The parameter ContTab contains the contingency table (including the margin sums, see figure below), the variable parameters chisq and p return the chi-square value and the corresponding p value, respectively.

The function returns the following error codes:

 0 ... everything is OK
-1 ... the contingency table is not a 2x2 table
-2 ... one of the margin sums is zero



Last Update: 2023-Feb-06