Wolfram Library Archive

Courseware Demos MathSource Technical Notes
All Collections Articles Books Conference Proceedings
Title Downloads

Token swap test revisited

Paul S. Heckerling
Organization: University of Illinois at Chicago
Journal / Anthology

Computer Methods and Programs in Biomedicine
Year: 2003
Volume: 70
Page range: 265-269

The token swap test measures the association between row and column variables of a 2×2 table in sample misclassification space, and makes no assumptions about repeated, random sampling from a source population. Despite its conceptual usefulness, the token swap test is not implemented by standard statistical software packages. Here the author describes ‘tokenSwaps’, a Mathematica program that performs a token swap test. The ‘tokenSwaps’ program also performs a one-tailed Fisher exact test, allowing results of the two methods to be compared. The program uses recursive functional programming and local rewrite rules to achieve substantial coding economy. Examples of the operation of the program are given, and its limitations are discussed.

Please cite the original paper if the program is used:

Heckerling PS. Token swap test revisited. Comput Meth Prog Biomed 2003; 70: 265-269

*Science > Medicine

Token swap test, Fisher exact test, Computer program

SWAPTST.txt (2.7 KB) - Text file