JAMDSJournal of Applied Mathematics and Decision Sciences1532-76121173-9126Hindawi Publishing Corporation98070610.1155/2009/980706980706Research ArticleComponents of Pearson's Statistic for at Least Partially Ordered m-Way Contingency TablesRaynerJ. C. W.BehEric J.BulgerDavidSchool of Mathematical and Physical SciencesUniversity of NewcastleNSW 2308Australianewcastle.edu.au200926102009200901052009221020092009Copyright © 2009This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

For at least partially ordered three-way tables, it is well known how to arithmetically decompose Pearson's XP2 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 XP2 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 XP2 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 XP2 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 XP2 into components, giving explicit formulae for these components. This enables XP2 to be partitioned into meaningful X2-type statistics. Using extensions of models for two-way tables discussed in , 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 XP2 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 ϕ2 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 {Nij/n}, it can be shown that XP2 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  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  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 I1×I2××  Im, completely ordered table of counts {Nv1vm}, Pearson’s XP2 is given by

XP2=v1=1I1vm=1Im(Nv1vm-E[Nv1vm])2E[Nv1...vm]. An extension of the approach in  demonstrates that XP2 has an arithmetic decomposition:

XP2=u1=0I1-1um=0Im-1Zu1um2, in which the components Zu1um, u1=0,,I1-1,, um=0,  ,Im-1, are given by

Zu1um=nv1=1I1vm=1Imau1(v1)aum(vm)pv1vm. Here n=ν1=1I1νm=1ImNν1νm and for j=1,,m, {auj()} is orthonormal on {p  vj}, in which pv1vm = Nv1vm/n and pvj is obtained from pv1vm by summing out all variables other than vj. Furthermore, the orthonormal systems all have zeroth term identically one. This work builds on the iconic work of Oliver Lancaster, for which see , and [3, Chapter 12] in particular.

It is routine to show that the components Zu1umare asymptotically multivariate normal, since an arbitrary linear combination of these variables is asymptotically normal by the central limit theorem. Utilizing the orthonormality of the {auj()}, 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 {Nv1vm} is the multinomial with count total n and cell probabilities {pν1νm} given by

pν1νm={u1=0I1-1um=0Im-1θu1umau1(v1)aum(vm)}pν1pνm, in which θ00=1 and θ00uj00=0 for all uj1. 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 θu1umare collectively zero against the negation of this is, as before, the sum of the squares of the Zu1um. Moreover, these components have the distributional properties given in the previous paragraph. Generalising [4, Theorem  8.2], this score test statistic is XP2. The score test has the advantage of weak optimality: see, for example, . An additional advantage of this approach is that it can be shown that Zu1um2 is the score test statistic when testing θu1um=0 against θu1um0 in an appropriate model. Thus, in an informal sense, every Zu1um is a detector of the corresponding θu1um.

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

i<j(Ii-1)(Ij-1)+i<j<k(Ii-1)(Ij-1)(Ik-1)+(I1-1)(I2-1)(Im-1)=  I1×I2××Im-1-(I1-1)-(I2-1)--(Im-1). The left-hand side consists of the degrees of freedom associated with all genuine two-way, three-way, and so forth m-way models, while the right-hand side is the number of cells minus one for the constraint n=ν1=1I1νm=1ImNν1νm (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  I1=3, I2=4, I3=5 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 {Nwz} are modelled by product multinomials, with the zth column being multinomial with total counts nz and cell probabilities:

pwz={1+u=1I1θuzau(w)/nz}pw, for w=1,,I1-1. Note that the probabilities in the I1th row are found by difference: pI1z=  1-p1z--p(I1-1)z and z=1,,I2, where pw=zNwz/n in which n=wzNwz. The efficient score contains random variables Zuz=(n/nz)w=1I1au(w)pwz 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 I2-1 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 Zu=(Zu1,,ZuI2)T and ZT=(Z1T,,ZI1-1T). The n×n identity matrix is written as In; 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 Z, the covariance matrix for Zu is II2-(nanb)/n. This is idempotent of rank  I2-1. There exists an I2×(I2-1) matrix A such that II2-(nanb)/n=  AAT and ATA=II2-1. 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 θu=(θu1,,θuI2)T=θ say is singular, define ϕ by Aϕ=θ. Then using the results of the lemma in [6, Section  3], the efficient score and information in terms of θ (Uθ and Iθ) and ϕ (Uϕ and Iϕ) are related by Uϕ=ATUθ and Iϕ=ATIθA, respectively. It follows that since, in terms of ϕ, the efficient score is ATZu=Yu say, and the information matrix is AT{II2-(nanb)/n}A=II2-1, the score test statistic in terms of ϕ is YuTYu=ZuT{II2-(nanb)/n}Zu. Since Yu is asymptotically NI2-1(0,II2-1), the score test statistic has the χI2-12 distribution, as is otherwise well known.

The columns of A are eigenvectors corresponding to the nonzero eigenvalues of {II2-(nanb)/n}. The eigenvector corresponding to the zero eigenvalue is (1,,1)T, so a typical eigenvector may be written 1. The elements of Yu=ATZu are of the form 1TZu, that may fairly be called a contrast between the elements of Zu. They are mutually independent and standard normal. While the Zui are immediately interpretable, they are slightly less convenient than Yui that are orthogonal contrasts and are asymptotically mutually independent and asymptotically standard normal. These contrasts correspond to each order u, u=1,,I1-1, 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 (n+1)×(n+1) matrix with all the elements of the first row 1/(n  +  1) and rth row 1/[r(r  +  1)] (r times), -r  /[r(r+1)], then all zeros.

4. Three-Way Partially Ordered Tables4.1. Singly Ordered Three-Way Tables

For singly ordered I1×I2×I3 tables, a product multinomial model is assumed, with the counts corresponding to the z1th column and z2th layer, z1=1,,I2 and z2=1,,I3, being multinomial with total counts nz1z2 and cell probabilities:

pwz1z2=pwu=0I1-1θuz1z2au(w), for w=1,,I1, in which θ0z1z2=1. Here and henceforth, the normalisation corresponding to the nz factor in pwz in Section 3 is absorbed into the θuz1z2. The components are random variables:

Zuz1z2=npz1pz2w=1I1au(w)pwz1z2, where pz1=wz2Nwz1z2/n and pz2=wz1Nwz1z2/n. The Zuz1z2 are immediately interpretable ), 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, u=1,,I1-1, we may construct orthogonal contrasts that are asymptotically mutually independent and asymptotically standard normal. These contrasts reflect uth moment comparisons between the levels of the unordered factors.

In , without a model, it is shown that XP2 is the sum of the squares of the Zuz1z2:

XP2=u=0I1-1z1=1I2z2=1I3Zuz1z22. In XP2, it is insightful to separate components corresponding to u=0 and u0. Thus

XP2=z1=1I2z2=1I3Z0z1z22+u=1I1-1z1=1I2z2=1I3Zuz1z22. The first summand corresponds to a two-way completely unordered table obtained by summing over rows and may reasonably be denoted by XZ1Z22. The second summation corresponds to a genuinely three-way singly ordered table and may reasonably be denoted by XUZ1Z22.

In  it is stated that the degrees of freedom associated with XP2 are I1I2I3-I1-I2-I3+2. This follows because there are (I2-1)(I3-1) degrees of freedom associated with XZ1Z22, and (I1-1)(I2I3-1) degrees of freedom associated with XUZ1Z22.

We can argue for these degrees of freedom by, when possible, counting the θuz1z2 or the Zuz1z2. The table corresponding to XZ1Z22 is completely unordered, so there are no θuz1z2 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 (I2-1)(I3-1). The table corresponding to XUZ1Z22 has degrees of freedom (I1-1)(I2I3-1) since this is the number of parameters θuz1z2 in the smooth model. There are I2I3 multinomials, each of which has (I1-1) parameters θuz1z2 as the multinomials probabilities sum to one (so the final cell probability is given by difference). In addition, one of the I2I3 multinomials is determined by {pw} 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 zth layer being multinomial with total counts nz and cell probabilities:

pw1w2z=pw1w2u1=0I1-1u2=0I2-1θu1u2zau1(w1)au2(w2), for w1=1,,I1, w2=1,,I2, and z=1,,I3, in which θ00z=θu10z=θ0u2z=1. The components are random variables:

Zu1u2z  =  npzw1=1I1w2=1I2au1(w1)au2(w2)pw1w2z for u1=0,,I1-1, u2=0,  ,I2-1, and z=1,,I3, where pz  =  w1w2Nw1w2z/n. Again, by the multivariate central limit theorem, the Zu1u2z are asymptotically multivariate normal. This does not depend on the smooth model. For each (u1,u2) 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 (1st,2nd) moment differences between the first two levels reflected by layers.

In , without a model, it is shown that XP2 is the sum of the squares of the Zu1u2z:

XP2  =  u1=0I1-1u2=0I2-1z=1I3Zu1u2z2. Again in XP2, it is insightful to separate components corresponding to ui=0 and ui0. Thus,

XP2=  z=1I3Z00z2  +  u1=1I1-1z=1I3Zu10z2+u2=1I2-1z=1I3Z0u2z2+u1=1I1-1u2=1I2-1z=1I3Zu1u2z2. 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 XU1Z2. The third summation corresponds to another two-way singly ordered table obtained by summing over rows and may reasonably be denoted by XU2Z2. The final summation corresponds to a genuine three-way doubly ordered table and may reasonably be denoted by XU1U2Z22.

In  it is incorrectly claimed that the associated degrees of freedom are, as in Section 4.1, I1I2I3-I1-I2-I3+2. The one-way table corresponding to the components with u1=u2=0 is uninformative, and should be ignored. The two-way tables corresponding to precisely one of the u1 or u2 zero are single-ordered, and, as in Section 3, have degrees of freedom (I1-1)(I3-1) and (I2-1)(I3-1), respectively. When neither u1 nor u2 is zero, the corresponding table is a genuine doubly ordered three-way table. There are I3 multinomials, each with (I1-1)(I2-1) parameters θu1u2z in their smooth model, but in fact the final of the I3 multinomials is determined by the {pz} and the remaining multinomials. So there are (I1-1)(I2-1)(I3-1) degrees of freedom for this final table. In all, the degrees of freedom are

(I1-1)(I2-1)(I3-1)+(I1-1)(I2-1)+(I1-1)(I3-1)=(I1I2-1)(I3-1).

We note that although the degrees of freedom in the Happiness Example of  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 s=m-r (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 {Nw1wrz1zs}. As in  and [4, Chapter 4], we define components of the form

Zu1urz1zs=  n{pz1××pzs}w1=1I1wr=1Irau1(w1)aur(wr)pw1wrz1zs, where pw1wrz1zs= Nw1wrz1zs/n and where {auj()}, pzj and pw1wrz1zs are defined similarly to the above. Again, by the multivariate central limit theorem, the Zu1urz1zs 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

XP2=u1=0I1-1ur=0Ir-1z1=1Ir+1zs=1ImZu1urz1zs2. By separating components corresponding to ui=0 and ui0,  XP2 can be partitioned as follows:

XP2=  z1=1Ir+1zs=1ImZ00z1zs2+i=1rui=1Ii-1z1=1Ir+1zs=1ImZ00ui00z1zs2+i,j=1ijrui=1Ii-1uj=1Ij-1z1=1Ir+1zs=1ImZ00ui00uj00z1zs2++u1=1I1-1ur=1Ir-1z1=1Ir+1zs=1ImZu1urz1zs2.   If s=1, the first term corresponds to a noninformative one-way table and contributes zero to the sum. The following term corresponds to all (s+1)-way singly ordered tables obtained by summing over r-1 ordered marginals and may reasonably be denoted by i=1rXUiZ1Zs2. The following term corresponds to all (s+2)-way doubly ordered tables obtained by summing over r-2 ordered marginals and may reasonably be denoted by

i,j=1ijrXUiUjZ1Zs2. 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 XU1UrZ1Zs2. Thus,

XP2=i=1rXUiZ1Zs2+i,j=1ijrXUiUjZ1Zs2++XU1UrZ1Zs2.

The smooth model envisaged here is product multinomial where for each (z1,,zs), the observations follow a multinomial distribution with total counts nz1zs and cell probabilities {pw1wrz1zs} given by

pw1wrz1zs=pw1××pwr{u1=0I1-1ur=0Ir-1θu1urz1zsau1(w1)aur(wr)}.

An extension of the approach in [4, Section  4.4] investigates testing if the θu1urz1zsare collectively zero against the negation of this. Generalising the work in [4, Section  4.4], the efficient score statistic is Zw1wrz1zs. 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 θu1urz1zs (or the corresponding components), or by the arguments in . Consider a genuine m-way table with the first r categories ordered and the remaining s=m-r categories not ordered. This includes tables corresponding to XUiUjZ1Zs2 say, resulting from summing out several of the ordered variables. This is now a doubly ordered (s+2)-way table. The degrees of freedom for XU1UrZ1Zs2 are (I1-1)(I2-1)(Ir-1)(Ir+1×Ir+2××Im-1). There are Ir+1×Ir+2××Im multinomials (corresponding to Z1=z1,,Zs=zs) each with (I1-1)(I2-1)(Ir-  1) 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 Zw1wrz1zs. The approach is similar to that employed in Section 3.

BehE. J.DavyP. J.Partitioning Pearson's chi-squared statistic for a completely ordered three-way contingency tableAustralian & New Zealand Journal of Statistics199840446547710.1111/1467-842X.00050MR1664197ZBL1127.62364BehE. J.DavyP. J.Partitioning Pearson's chi-squared statistic for a partially ordered three-way contingency tableAustralian & New Zealand Journal of Statistics199941223324610.1111/1467-842X.00077MR1705401ZBL1045.62519LancasterH. O.The Chi-Squared Distribution1969New York, NY, USAJohn Wiley & Sonsxiv+356MR0253452RaynerJ. C. W.BestD. J.A Contingency Table Approach to Nonparametric Testing2001Boca Raton, Fla, USAChapman & HallBhatB. R.NagnurB. N.Locally asymptotically most stringent tests and Lagrangian multiplier tests of linear hypothesesBiometrika1965523-445946810.1093/biomet/52.3-4.459MR0207102ZBL0156.39503RaynerJ. C. W.The asymptotically optimal testsJournal of the Royal Statistical Society: Series D199746333734610.1111/1467-9884.00087