Tests of Independence for Frequency Data

Two-way tables (contingency tables) evaluate whether one property (g.g. eye color) occurs independently of another (e.g. sex). For this analysis, represent the categories (i.e. red eyes, white eyes, green eyes) of one property with columns, categories of the second property (i.e. male, female) in rows, and enter the observed frequencies for each cell. Expected frequencies are calculated for each cell under the null scenario. If the difference between observed and expected frequencies is large then we have reason to suspect a link (i.e. lack of independence) between the two properties. Chi-square ("X2") or G-tests ("G") determine whether these differences are large enough to warrant dropping the null hypothesis. William's correction is performed and all statistics must be compared to a Chi-square distribution with appropriate degrees of freedom. Freeman-Tukey deviates ("Cells") permit a cell-wise examination of the table to identify which cell values are particularly "large" or "small" compared to the null hypothesis. Square matrices are a special case in several regards. Matrix shape: If the matrix is symmetrical, then the upper right and lower left triangles mirror each other. Missing diagonal: Several types of behavioral matrices will contain cells which are necessarily empty. For example, interactions in groups of individuals can only occur with another animal of the group but never with itself. Transition matrices may look at how often each behavior changes into another behavior. In both cases the cells along the diagonal will be empty. If expected frequencies are calculated according to the usual techniques, row and column sums of expected and observed frequencies will not match. A solution to this problem is an iterative process summarized by Goodman 1968 J. Am. Stat. Assoc. 63: 1091-1131. Once the expected frequencies have been determined properly, standard Chi-Square, G-Tests, and Freeman-Tukey deviates can again be calculated.

Analysis of Two-way Frequency Tables using Applet "FrequencyMatrixApplet" Version 3.1 (updated on 1/6/09).
Columns Rows Matrix Shape Diagonal

Thanks: Christoph Goessmann worked out the specifics of the iteration procedure and explained them to me :-)

The Applet chronicles contain information on changes, features, and bug fixes for different versions of these applets.

Back to JavaGrinders.


last updated 1/11/11