Test for temporal structure in behavior

Two-way tables (contingency tables) evaluate whether the occurrence of a particular behavior is independent of a subsequent one. For this analysis, each cell of the matrix represents a transition from behavior A (rows) to behavior B (columns). Enter the frequencies of these transitions and decide whether a behavior pattern can be followed by the same behavior (include the diagonal) or whether you are only interested when a behavior changes into another behavior (exclude the diagonal). 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 temporal structure in this behavior (i.e. lack of independence). Chi-square ("Chi2") or G-tests ("G-Val") 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 and identify cells which are very large or very small, eg. which behavior is highly likely/unlikely be followed by which other behaviors.

Transition matrix

Such 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: Transition matrices may look at how often each behavior changes into another behavior, thus, the cells along the diagonal will by definition remain 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 Matrix Shape

This page is a collaboration with Christoph Goessmann, who worked out the specifics of the iteration procedure and explained them to me :-) Back to Java grinders behavior stats page.

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