"mcnemar.test" does McNemar-Bowker test (Bowker's test) which tests
symmetry, not marginal homogeneity.
Marginal homogeneity and symmetry are equivalent in 2x2 matrices but
not for larger tables.
I also was confused because many resources (for example Wikipedia
accessed 2020-08-30) introduce McNemar's test as a test of marginal
homogeneity (which it is only for 2x2 matrices).
The R Reference Manual entry for mcnemar.test states that it tests for symmetry.
The code for mcnemar.test is also consistent with the McNemar-Bowker
test for symmetry.
Is there a bug in the command?
Since the function does what the manual states it does, I would not
call this a bug.
Although, I would like it if the result of mcnemar.test would print
"McNemar's Chi-squared test of symmetry" rather than just "McNemar's
Chi-squared test."
Is the one necessarily better then the other? (for example for
sparser matrices ?)
mcnemar.test often fails for sparse matrices, because symmetric zeros
produce a NaN due to division by zero in the following line of
mcnemar.test code:
STATISTIC <- sum(y[upper.tri(x)]^2/x[upper.tri(x)])
The McNemar-Bowker test uses Chi-squared approximation, which would
not be good for small counts (and sparse matrices).
mcnemar.test does not perform continuity correction for matrices
larger than 2x2.
Is there an exact test for symmetry of matrices larger than 2x2?
I could not find one.