# Analysis of the Minimum Discriminant Information Statistic

    library(ordinalTables)

# Analysis of the Minimum Doscriminant Information Statistic (mdis)

## Data

For this vignette we will again use the vision data (vision_data).

`r{vision_data} vision_data`

Row sums = 1976, 2256, 2456, 789 Column sums = 1907, 2222, 2507, 841

## The Minimum Discrinant Information Statistic

For background on the measure, refer to Ireland, Ku, and Kullback (1969). Symmetry and marginal homogeneity in a r X r contingency table, Journal of the American Statistical Association, 64(328), 1323-1341. In that paper, Ireland et al. give procedures for computing 3 relevant models: marginal homogeneity, symmetry, and quasi-symmetry. They also show how the MDIS can be broken down for nested tests of these models. Like chi-square, MDIS is minimized when fitting models to a table. Similarly, it can be compared to a central chi-square distribution when assessing the quality of the fit. Finally, the measure is subtractive, which means that it is possible to break down fit into components of less restrictive models. For example, Symmetry is equivalent to marginal homogeneity and quasi-symmerty. Because of the additive nature of MDIS, MDIS(symmetry) = MDIS(marginal homogeneity) + MDIS(quasi-symmetry) (see below).

One unique aspect of the Ireland et al. paper is that they note that the diagonal entries of the table are not relevant to the comparisons of models, and so they give algorithms for analyzing the full table and for “truncated” tables, excluding the diagonal entires. Each of the functions, Ireland_symmetry(), Ireland_marginal_homogeneity() and Ireland_quasi_symmetry() takes an optional logical parameter “truncated”, which if TRUE excludes the diagonal cells from the analysis and the computation of the fit measure. The default for truncated is FALSE, include the diagonal.

## Symmetry

Symmetry is the strongest model for square tables. It implies both marginal homogeneity and the weaker quasi-symmetry. Symmetry says that the cells on either side of the diagonal (n[i, j] and n[j, i]) are equal except for sampling variation. From the MDIS perspective, the function to fit this model is Ireland_symmetry().

    symmetry <- Ireland_symmetry(vision_data)

For the vision data, this model gives an mdis value of 19.3348137 and 6 degrees of freedom, with an associated p-value of `1.0 - pchisq(synmetry$mdis, symmetry$df)`. So symmetry is rejected for the vision data.

A related test for symmetry is Bowker_symmetry()

    bowker <- Bowker_symmetry(vision_data)

This gives a similar result, with a Pearson X^2 of 19.1065502 on 6 degrees of freedoom.

## Marginal Homogeneity

Testing hypotheses about the margins is covered in detail in the vignette “Checking Whether the Margins are Ordered.” For the purpose of this vignette, the marginal homogeneity model is fit using the function Ireland_marginal_homogeneity().

    marginal_homogeneity <- Ireland_marginal_homogeneity(vision_data)

The MDIS for the symmetry model is 11.8365927 on 3 degrees of freedom, with a p-value 0.0079644, leading us to reject marginal homogeneity for the vision data.

## Quasi-symmetry

Quasi-symmetry is defined in terms of an underlying d(ij) which is symmetric, d(ij) = d(ji). Then quasi-symmetry states (p. 1325) that the cell probability p(ij) is a dfcntioon of d(ij) multiplied by a row effect p(i) and a column effect q(j): p(ij) = p(i)q(j)d(ij). Quasi-symmerty and its variations are examined in more detail in the vignette “Models to Fit to Square Tables”.

Because MDIS(symmetry) = MDIS(marginal homogeneity) + MDIS(quasi-symmetry), the MDIS for quasi-symmetry can be computed by subtraction: MDIS(symmetry) - MDIS(marginal homogeneity). This is computed using Ireland_quasi_symmetry():

    quasi1 <- Ireland_quasi_symmetry(vision_data)

which yields a MDIS value of 7.498221 on 3 degrees of freedom.

If there is a desire to fit the quasi-symmetry model (for example to see predicted values), Ireland_quasi_symmetry_model() can be used to fit it:

    quasi2 <- Ireland_quasi_symmetry_model(vision_data)

which gives a early identical MDIS of 7.4298932 on 3 degrees of freedom, which is not significant, p = 0.0593874, and so the hypothesis of quasi-symmetry is not rejected for the vision data.

Finally, we note that fitting the models with the option truncated = TRUE yields neary identical results:

    truncated_sym <- Ireland_symmetry(vision_data, truncated=TRUE)
    truncated_mh <- Ireland_marginal_homogeneity(vision_data, truncated=TRUE)
    truncated_qs <- Ireland_quasi_symmetry_model(vision_data, truncated=TRUE)

with MDIS values of 19.3652424, 12.0102488, and 7.300698, leading to the same conclusions. Note that when truncated = TRUE, the diagonal cells for the estimated frequencies x_star and the estimated proportions p_star are returned as 0.0.