#### Abstract

For at least partially ordered three-way tables, it is well known how to arithmetically decompose Pearson's statistic into informative components that enable a close scrutiny of the data. Similarly well-known are smooth models for two-way tables from which score tests for homogeneity and independence can be derived. From these models, both the components of Pearson's and information about their distributions can be derived. Two advantages of specifying models are first that the score tests have weak optimality properties and second that identifying the appropriate model from within a class of possible models gives insights about the data. Here, smooth models for higher-order tables are given explicitly, as are the partitions of Pearson's into components. The asymptotic distributions of statistics related to the components are also addressed.

#### 1. Introduction

In [1, 2] it is shown how, for at least partially ordered three-way tables, to arithmetically decompose Pearsonβs statistic into informative components that enable a close scrutiny of the data. They focus on three-way tables as being indicative of higher-order tables. Here, we give models for arbitrary multiway tables that are at least partially ordered. We discuss the arithmetic decomposition of into components, giving explicit formulae for these components. This enables to be partitioned into meaningful -type statistics. Using extensions of models for two-way tables discussed in [3], the asymptotic distribution of statistics related to these components may be given.

At the onset, we should say what we mean by βordered.ββ A random variable is a mapping from the sample space to the real line. It is ordered if and only if the ordering of the range is meaningful. So, for example, a range containing only zero and one, denoting male and female, would not usually be considered meaningful. However, it would usually be considered meaningful if the zero and one denoted low and high, respectively. A variable is ordered if and only if it reflects a random variable that is ordered rather than not ordered, or nominal. A table is completely ordered if and only if all variables are ordered. It is partially ordered if and only if at least one but not all variables are ordered.

To give precedence, we observe here that the arithmetic decomposition of Pearsonβs statistic for two- and three-way tables can be shown quite compactly using results from [3, Chapter 4, Theorems β2.1 and β2.2, pages 90-91 and Theorem β5.2, page 101]. It is shown there that for contingency tables Lancasterβs is equal to the sum of the squares of the elements of a vector in the subsequent models. In a parallel manner, working with observed proportions , it can be shown that is equal to the sum of the squares of components. This observation applies to verifying the results in [1, 2]. Moreover, precedence should be given to the work in [3, Chapter 12] for material throughout this paper.

We also note that the work in [4] considered models for ordered two-way contingency tables. In [4, Chapter 3], an extended hypergeometric model is used when both row and column marginal totals are known. This is not a smooth model and here we will not discuss either it or its extensions further. In [4, Chapter 8], doubly ordered models are considered, and these will be generalised in Section 2 in what follows.

In treating a singly ordered table, the work in [4, Chapter 4] assumed the total count for each treatment is known before sighting the data, and this leads to a smooth product multinomial model. If the treatment totals are not known before sighting the data, the resulting model is a single multinomial with cell probabilities modelled the same way as when the treatment totals are known before sighting the data. The models in [1, 2] are single multinomials, following the second approach. However, it is clear that, in general, for partially ordered tables, there are a multitude of possible models, depending on which marginal totals are assumed known before sighting the data. In all cases, the logarithms of the likelihoods are, apart from unimportant constants, the same. Henceforth, we will consistently work with product multinomials and note that the distributional results developed apply to the multitude of models indicated.

The outline of this paper is as follows. In Section 2, the more routine case of completely ordered multiway tables is discussed. The balance of the paper is about the more complicated partially ordered tables. In Section 3, the work of [4] on partially ordered tables is reviewed. In Section 4, the work in [1, 2] is reviewed and extended using smooth models. Section 5 gives the generalizations to arbitrary multiway partially ordered tables.

#### 2. Completely Ordered Multiway Tables

For an *m*-way completely ordered table of counts , Pearsonβs is given by

An extension of the approach in [1] demonstrates that has an arithmetic decomposition:

in which the components , , , are given by

Here and for , is orthonormal on , in which = and is obtained from by summing out all variables other than . Furthermore, the orthonormal systems all have zeroth term identically one. This work builds on the iconic work of Oliver Lancaster, for which see [3], and [3, Chapter 12] in particular.

It is routine to show that the components are asymptotically multivariate normal, since an arbitrary linear combination of these variables is asymptotically normal by the central limit theorem. Utilizing the orthonormality of the , it can be shown that all components have expectation zero, variance unity, and covariances zero. They are thus asymptotically mutually independent and asymptotically standard normal.

One possible smooth model for is the multinomial with count total *n* and cell probabilities given by

in which and for all . This model includes all genuine two, three, and so forth *m*-way independence models. A routine extension of [4, Theorem β8.1] shows that the score test statistic for testing, that the are collectively zero against the negation of this is, as before, the sum of the squares of the . Moreover, these components have the distributional properties given in the previous paragraph. Generalising [4, Theorem β8.2], this score test statistic is . The score test has the advantage of weak optimality: see, for example, [5]. An additional advantage of this approach is that it can be shown that is the score test statistic when testing against in an appropriate model. Thus, in an informal sense, every is a detector of the corresponding .

The degrees of freedom associated with are the number of (and hence ) in the model, excluding those that are by convention always zero or one. The degrees of freedom are thus

The left-hand side consists of the degrees of freedom associated with all genuine two-way, three-way, and so forth -way models, while the right-hand side is the number of cells minus one for the constraint (reflecting that the sample size is known before sighting the data) minus the degrees of freedom associated with all one-way (essentially goodness of fit) models. For the happiness example in [1] , , and substituting in the aforementioned formulae, there are 50 degrees of freedom.

#### 3. Two-Way Singly Ordered Tables

β In [4, Section β4.4] two-way tables are discussed. We report on that discussion using our subsequent convention that ordered categories precede unordered categories. Tables are modelled by product multinomials, with the *z*th column being multinomial with total counts and cell probabilities:

for . Note that the probabilities in the th row are found by difference: and where in which . The efficient score contains random variables and the information matrix is found to be singular. In order to find a score test statistic in [4, Section β4.4], the model is modified by removing the s corresponding to the last column because the model is overparameterised: in any row, given the probabilities in the first columns and the marginal probability for that row (the average of all probabilities in that row), the probability corresponding to the final column can be readily determined. A quicker approach is now outlined.

Write )* ^{T}* and . The identity matrix is written as ; this will be clear from the context when this, and not the number of rows, and so forth, is intended. From the information matrix for the covariance matrix for is . This is idempotent of . There exists an matrix

*A*such that and . We now focus on a smooth model containing just one value of

*u*(the full model is similar). Since the information matrix in terms of say is singular, define by . Then using the results of the lemma in [6, Section β3], the efficient score and information in terms of ( and ) and ( and ) are related by and respectively. It follows that since, in terms of , the efficient score is say, and the information matrix is , the score test statistic in terms of is . Since is asymptotically , the score test statistic has the distribution, as is otherwise well known.

The columns of *A* are eigenvectors corresponding to the nonzero eigenvalues of . The eigenvector corresponding to the zero eigenvalue is , so a typical eigenvector may be written . The elements of are of the form , that may fairly be called a contrast between the elements of . They are mutually independent and standard normal. While the are immediately interpretable, they are slightly less convenient than that are orthogonal contrasts and are asymptotically mutually independent and asymptotically standard normal. These contrasts correspond to each order , , and reflect comparisons between the levels of the unordered factor. They may, for example, compare the means of the first two levels, the mean of the first two levels with that of the third level, the mean of the first three levels with that of the fourth level, and so on. Such contrasts may be described as Helmertian, from the Helmert matrix. In its simplest form, the Helmert matrix is an orthogonal matrix with all the elements of the first row and th row (*r* times), , then all zeros.

#### 4. Three-Way Partially Ordered Tables

##### 4.1. Singly Ordered Three-Way Tables

For singly ordered tables, a product multinomial model is assumed, with the counts corresponding to the th column and th layer, and , being multinomial with total counts and cell probabilities:

for , in which . Here and henceforth, the normalisation corresponding to the factor in in Section 3 is absorbed into the . The components are random variables:

where and . The are immediately interpretable [2]), and, by the multivariate central limit theorem, are asymptotically multivariate normal. This does not depend on the smooth model. As in Section 3, for each *u*, , we may construct orthogonal contrasts that are asymptotically mutually independent and asymptotically standard normal. These contrasts reflect th moment comparisons between the levels of the unordered factors.

In [2], without a model, it is shown that is the sum of the squares of the :

In it is insightful to separate components corresponding to and . Thus

The first summand corresponds to a two-way completely unordered table obtained by summing over rows and may reasonably be denoted by . The second summation corresponds to a genuinely three-way singly ordered table and may reasonably be denoted by .

In [2] it is stated that the degrees of freedom associated with are . This follows because there are degrees of freedom associated with and degrees of freedom associated with .

We can argue for these degrees of freedom by, when possible, counting the or the . The table corresponding to is completely unordered, so there are no to count. We propose no smooth model, and our components are not appropriate when there is no order. However, the degrees of freedom are known independently to be . The table corresponding to has degrees of freedom since this is the number of parameters in the smooth model. There are multinomials, each of which has parameters as the multinomials probabilities sum to one (so the final cell probability is given by difference). In addition, one of the multinomials is determined by and the remaining multinomials.

##### 4.2. Doubly Ordered Three-Way Tables

For doubly ordered tables a product multinomial model is again assumed, with the counts corresponding to the th layer being multinomial with total counts and cell probabilities:

for , and , in which . The components are random variables:

for , and , where . Again, by the multivariate central limit theorem, the are asymptotically multivariate normal. This does not depend on the smooth model. For each pair, as in Section 3, we may construct orthogonal contrasts that are asymptotically mutually independent and asymptotically standard normal. These contrasts reflect bivariate moment comparisons between the levels of the unordered factor. A typical contrast may be stnd moment differences between the first two levels reflected by layers.

In [2], without a model, it is shown that is the sum of the squares of the :

Again in it is insightful to separate components corresponding to and . Thus,

The first summand is identically zero. The second summand corresponds to a two-way singly ordered table obtained by summing over columns and may reasonably be denoted by . The third summation corresponds to another two-way singly ordered table obtained by summing over rows and may reasonably be denoted by . The final summation corresponds to a genuine three-way doubly ordered table and may reasonably be denoted by .

In [2] it is incorrectly claimed that the associated degrees of freedom are, as in Section 4.1, . The one-way table corresponding to the components with is uninformative, and should be ignored. The two-way tables corresponding to precisely one of the or zero are single-ordered, and, as in Section 3, have degrees of freedom and , respectively. When neither nor is zero, the corresponding table is a genuine doubly ordered three-way table. There are multinomials, each with parameters in their smooth model, but in fact the final of the multinomials is determined by the and the remaining multinomials. So there are degrees of freedom for this final table. In all, the degrees of freedom are

We note that although the degrees of freedom in the Happiness Example of [2] are in error, the *P* values and conclusions with the correct degrees of freedom are as given there. We recommend the reader refer to this example, examined from two different perspectives in [1, 2], to see the insight and interpretability the components give to data analysis.

#### 5. m-Way Partially Ordered Tables

We consider now an *m*-way table that is at least partially ordered: without loss of generality the first *r* (1) categorical variables are taken as ordered and the remaining (1) categorical variables are nominal. The notation reflects this convention; the subscripts *w* reflect ordered categories while the subscripts *z* reflect nominal categories. Accordingly, the table is denoted by . As in [2] and [4, Chapter 4], we define components of the form

where = and where , and are defined similarly to the above. Again, by the multivariate central limit theorem, the are asymptotically multivariate normal. This does not depend on the smooth model.

By manipulations similar to those for the three-way case, it is possible to argue that

By separating components corresponding to and can be partitioned as follows:

If , the first term corresponds to a noninformative one-way table and contributes zero to the sum. The following term corresponds to all -way singly ordered tables obtained by summing over ordered marginals and may reasonably be denoted by . The following term corresponds to all -way doubly ordered tables obtained by summing over ordered marginals and may reasonably be denoted by

The subsequent terms involve components with successively more ordered marginals and correspond to tables that are of increasing size. The final term corresponds to a genuine *m*-way *r*-fold ordered table and may reasonably be denoted by . Thus,

The smooth model envisaged here is product multinomial where for each , the observations follow a multinomial distribution with total counts and cell probabilities given by

An extension of the approach in [4, Section β4.4] investigates testing if the are collectively zero against the negation of this. Generalising the work in [4, Section β4.4], the efficient score statistic is . The information matrix is block diagonal but each block is singular. Nevertheless, the efficient score is asymptotically normal and appropriate orthogonal contrasts are asymptotically mutually independent and standard normal.

The degrees of freedom may be deduced either by counting (or the corresponding components), or by the arguments in [2]. Consider a genuine *m*-way table with the first *r* categories ordered and the remaining categories not ordered. This includes tables corresponding to say, resulting from summing out several of the ordered variables. This is now a doubly ordered -way table. The degrees of freedom for are . There are multinomials (corresponding to ) each with degrees of freedom. However, one of these multinomials is determined by the marginals and the other multinomial models.

We decline to write out the contrasts corresponding to the asymptotically mutually independent standard normal variables that are linear combinations of the . The approach is similar to that employed in Section 3.