the R package HHG , which can be freely downloaded from the Comprehensive R Archive Network, http://cran.r-project.org/ . Null tables can be downloaded from the first author’s web site. We assume that Y is a continuous random variable, and that X is either continuous or discrete. We have N independent realizations ( x$_{1}$, y$_{1}$ ) , . . . , ( x$_{N}$, y$_{N}$ ) from the joint distribution of X and Y . Our test statistics will only depend on the marginal ranks, and therefore are distribution free, i.e., their null distributions are free of the marginal distributions F$_{X}$ and F$_{Y}$ . Test statistics for the K -sample problem We first consider the case that X is categorical with K ≥ 2 categories. In this case, a test of association is also a K - sample test of equality of distributions. For N observations, there are ( N +1 2 ) possible cells, and ( N − 1 m − 1 ) possible partitions of the observations into m cells, where a cell is an interval on the real line. Since the cell membership of observations is the same regardless of whether the partition is defined on the original observations or on the ranked observations, and the statistics we suggest only depend on these cell memberships, we describe the proposed test statistics on the ranked observations, rank ( Y ) ∈ { 1 , ..., N } . Let Π$_{m}$ denote the set of partitions into m cells. For any fixed partition I = { i$_{1}$, . . . , i$_{m}$$_{−}$$_{1}$ } ⊂ { 1 . 5 , . . . , N − 0 . 5 } , i$_{1}$ < i$_{2}$ < . . . < i$_{m}$$_{−}$$_{1}$ , C ( I ) is the set of m cells defined by the partition. For a cell C ∈ C ( I ), let o$_{C}$ ( g ) and e$_{C}$ ( g ) be the observed and expected counts inside the cell for distribution g ∈ { 1 , . . . , K } , respectively. The expected count e$_{C}$ ( g ) is the width of cell C based on ranks multiplied by N$_{g}$/N , where N$_{g}$ is the total number observations from distribution g : e$_{[}$$_{i}$$_{l}$$_{,i}$$_{l}$$_{+1}$$_{]}$ ( g ) = 9 2 The proposed statistics