[R] Can I use "mcnemar.test" for 3*3 tables (or is there a bug in the command?)
Charles C. Berry
cberry at tajo.ucsd.edu
Mon Jul 20 02:10:04 CEST 2009
On Sun, 19 Jul 2009, Peter Dalgaard wrote:
> Charles C. Berry wrote:
>
>>
>> The test mcnemar.test() constructs is one of symmetry, which is equivalent
>> to marginal homogenity in hierarchical log-linear models as I recall from
>> Bishop, Fienberg, and Holland's 1975 opus on count data.
>
> Umm, er... Symmetry in the 3x3 table is a 3DF hypothesis, whereas marginal
> homogeneity has 2DF, so unless I'm missing a fine point in the requirement of
> "hierarchical log-linear", I'd say that one implies the other, but not the
> other way around.
Right, symmetry equals marginal homogenity plus 'quasi-symmetry' - a
condition on the odds-ratios of a two way table and here that condition
uses one degree of freedom.
But, representing marginal homogenity in log-linear models gets sticky
without that quasi-symmetry condition.
---
Taking m_{ij} to be the expected cell frequencies in a two way table, the
log-linear model for the two way table is
log m_{ij} = \mu + \mu_{1(i)} + \mu_{2(j)} + \mu_{12(ij)}
with side conditions that any of the subscripted \mu terms sums to zero
over any of its subscripts. In the notation here, \mu is an intercept,
\mu_1 terms are row effects, \mu_2 terms are column effects, and \mu_{12}
terms are interactions of the row and columns. The parenthical terms (i),
(j), or (ij) index the row, column, or cell.
In the case of the 3 x 3 table, there are 1, 2, 2, and 4 degrees of
freedom respectively for each of the sets of terms in the saturated
log-linear model.
---
Marginal homogenity says m_{i+} = m_{+i}, all i, taking m_{ij} to be the
expected cell frequencies and the {i+} notation to indicate summation over
the missing subscript.
---
Trying to set up a log-linear model for marginal homogeneity would lead
you to equate the row and column effects:
log m_{ij} = \mu + \mu_{1(i)} + \mu_{1(j)} + \mu_{12(ij)}
but this does not imply marginal homogenity given the side conditions
unless the \mu_{12(ij)} obey additional constraints which also implies
symmetry.
>
> E.g., you can easily check that the following two matrices have the same
> homogeneous margins, but only one is symmetric
>
> 3 2 1
> 2 3 2
> 1 2 3
>
> 3 1 2
> 3 3 1
> 0 3 3
>
If you want to represent this last table as
m_{ij} = \exp(\mu + \mu_{1(i)} + \mu_{1(j)} + \mu_{12(ij)})
you cannot get there with the side conditions that are imposed on
\mu_{12}. You need additional terms.
Chuck
> --
> O__ ---- Peter Dalgaard Ãster Farimagsgade 5, Entr.B
> c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
> (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
> ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ - (p.dalgaard at biostat.ku.dk) FAX: (+45)
> ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 35327907
>
>
Charles C. Berry (858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
More information about the R-help
mailing list