This vignette looks at the related set of models that can be fit to a square table. Specifically, the models of symmetry, marginal homogeneity, and versions of quasi-symmetry are examined. The material parallels Chapter 11 of Agresti(1984). Measures based on minimizing the criterion Minimum Discriminant Information Statistic are discussed in the vignette “Analysis of the Minimum Discriminant Information Statistic”.
The data on visual acuity of women working at the Royal Ordinance factory, vision_data will be used.
The test of symmetry is Bowker_symmetry()
This leads to a significant X^2 of 19.1065502 on 6 degrees of freedom, leading to the rejection of the hypothesis of symmetry.
There are two tests of marginal homogeneity, Stuart_marginal_homogeneity() and Bhapkar_marginal_homogenity().
stuart <- Stuart_marginal_homogeneity(vision_data)
bhapkar <- Bhapkar_marginal_homogeneity(vision_data)
The measures yield similar X^2 for this data, 11.9565696 and 11.9757202 on 3 degrees of freedom, leading to rejecting the hypothesis of marginal homogeneity. See the related vignette “Checking of Margins are (Stochasically) Ordered”.
Quasi-symmetry can be fit as a general log-linear model by specifying the correct design matrix X. There is also a direct test of the hypothesis, Bhapkar_quasi_symmetry()
This is non-sigificant, 7.2246554 on 3, with a p-value of 0.0650717.
The basic quasi-symmetry model can be described as modeling a cell frequency p(ij) as a function of a row effect p(i), a column effect q(j), and a symmetry effect d(ij) where d(ij) = d(ji) for all i and j. Then, p(ij) = p(i)q(j)d(ij). This is a simple log-linear model and can be fit that way.
Several authors have suggested specializations of the basic quasi-symmetry model. McCullagh (1978) gives 4, quasi-symmetry, conditional symmetry, palindromic symmetry and generalized palindromic symmetry. The last two models get their name from the property that the categories cannot be arbitrarily re-arranged and still have the model hold. Instead, the only change in the order of categories that maintains the model is a complete reversal of the categories, where, for example, 1 -> 4, 2 -> 3, 3 -> 2, and 4 -> 1. Fitting each of McCullagh’s models to the vision data is striaghtforward.
conditional <- McCullagh_conditional_symmetry(vision_data)
quasi2 <- McCullagh_quasi_symmetry(vision_data)
palindrome <- McCullagh_palindromic_symmetry(vision_data)
gen_palindrome <- McCullagh_generalized_palindromic_symmetry(vision_data)
For conditional symmetry, the Pearson X^2 is 7.2612035 and the likelihood ratio G^2 is 7.3534546, both on 5 degrees of freedom. The asymmetry parameter is 1.0738193.
For quasi-symmetry, the Pearson X^2 is 7.2592336 on 3 degrees of freedom. The vector asymmetry parameters is 1, 0.9496751, 0.8987201, 0.8551141, but alpha[1] is constrained to be 1.0.
Palindormic symmetry yields a vector of asymmetry parameters alpha as
well as a general asymmetry parameter theta. The model takes a few
seconds to run (this will improve in subsequent releases). The alpha
vector is 1, 0.9635121, 0.9358308 (recall alpha[1] is constrained to be
1.0), and the asymmetry parameter delta is estimated to be 0.1664323
with a standard eorror of 0.0464539 for a z-score of 3.582742. The
overall fit of the model is good, r$palindrome$chisq
on 3
degrees of freedom.
Generalized palindromic symmetry has the same basic structure as
palindromic symmetry, but there is a vector of delta parameters instead
of just one. The fit of the model is good (6.1719105 on 1 degrees of
freedom). The alpha vector is gen_palindrome$alpha
and the
delta vector of asymmetry parameters is .
Goodman proposed a different set of constraints, this time on the diagonals that parallel the main diagonal (e.g, m_ij where |i - j| = k). The Goodman_diagonals_parameter_symmetry() model specifies that each set of diagonal cells all deviate from symmetry by a set amount
diagonal <- Goodman_diagonals_parameter_symmetry(vision_data)
equal <- c(FALSE, TRUE, TRUE)
constrained_diagonal <- Goodman_constrained_diagonals_parameter_symmetry(vision_data, equal)
fixed <- c(FALSE, TRUE, FALSE)
delta <- c(1.0, 1.0, 1.0)
fixed_diagonal <- Goodman_fixed_parameter(vision_data, delta, fixed)
The original diagonals parameter model has one parameter per diagonal (r - 1 for an r X r table). These parameters are in the delta vector, 0.8582503, 0.9851485, 0.5454545. The basic model fits the data well, with “ominibus_chisq” X^2 = 0.4978503 on omnibus_df 3 degrees of freedom. A fit measure is also returned for model that constrains all delta parameters to be equal, equality_chisq and equality_df.
It is possible to constrain a subset of the delta parameters to be
equal using Gooodman_constrained_diagonals_parameter_symmmetry(). This
takes two arguments, the data matrix and a logical vector indicating
whether the corresponding parameter is part of the equality-constrained
set. The example constrains the last two parameters to be equal. The
estimate of the common parameter 1.1134454 is available in the
common_delta member of the result. Looking at the members that start
with “pooled”, the X^2 of
r
constrained_diagonal$pooled_chisq` on 2 degrees of freedom
indicates that this model fits very well too. The common delta is
1.1134454. The equality test here is somewhat misleading. It tests the
hypothesis that the remaining deltas combined with the pooled one are
equal.
The other option with the diagonals symmetry model is to fix certain delta parameters at specified values. The parameters are fixed by indicating TRUE in the element of the delta vector; FALSE should be specified for the parameters to be estimated. The values are specified in the vector delta. Values for the non-constrained parameters serve as starting values. They should be positive, and 1.0 seems to work well. The function is Goodman_fixed_parameter() with arguments data matrix, delta values, and the fixed-free vector. When this model is fit to the vision data, constraining delta[2] = 1.0, the fit is still excellent at X^2 = 0.5202906 on 4 degrees of freedom. Examining the delta vector 0.8583129, 1, 0.5454682 shows that element 2 was indeed held constant at its value of 1.0.
Agresti proposed a simplified version of the diagonals parameter symmetry model using a single delta parameter. For diagonal |i - j| = k, delta = delta^k.
The model returns an acceptably low X^2 (7.2689213) on 5 degrees of freedom. The test of the parameter beta 0.0535311 with standard error of is significant, z = 3.4500256. Finally, the estimate of the diagonal parameter delta is 1.1130034.