# Relationship to McNemar's test

In the case of one dichotomous predictor the conditional logistic regression is equivalent to McNemar's test (see Agresti, 1996; p.227-228).

Agresti shows that paired probability e.g. of a subject correctly recalling an item using working memory and then the same item using long-term memory equals a test of the number of mismatches of recalling the item correctly using one test but not the other.

Difference in memory proportions =

$$\frac{\mbox{HH + HE}}{\mbox{HH + HE + EH + EE}} - \frac{\mbox{HH + EH}}{\mbox{HH + HE+ EH + EE}} = \frac{\mbox{HE - EH}}{\mbox{HH+EH+HE+EE}} = \frac{\mbox{HE}}{\mbox{HH+EH+HE+EE}} - \frac{\mbox{EH}}{\mbox{HH+EH+HE+EE}}$$

= P(EH) - P(HE) as given in the formula on page 227 of Agresti (1996)

where the Hij are given in the table below with, for example, HE representing a hit or correct recall on test 1 with an error or incorrect recall on test 2 on the same item (see the table below).

test1\test2 |
H |
E |

H |
HH |
HE |

E |
EH |
EE |

Heterogenity of mismatch probabilities across subjects

Since the subjects are assumed independent one can test to see whether the conditional probability, P(HE given either a HE or EH occurs), varies across subjects in an analogous way to the testing of differences in probabilities from surveys described on page 228 of Agresti (1996).

Entering the frequency data, as in the table below, enables the usual independence model chi-squares to be used e.g. using CROSSTABS in SPSS with mismatch type and subject as the row and column factors.

Memory test Mismatch |
Frequency |
Subject |

HE |
2 |
1 |

EH |
6 |
1 |

HE |
8 |
2 |

EH |
6 |
2 |

Heterogeneity of mismatch probabilities across levels of a between subjects factor

We can further consider an example looking at differences in numbers of mismatched pairs across levels of a between subjects factor. Suppose we have a number of case-control pairs measuring the presence or absence of a disorder and we wish to see if they differ on rates of disorder in different age groups.

Disorder Mismatch |
agegroup |
count |

Present,Absent |
1 |
5 |

Absent,Present |
1 |
3 |

Present,Absent |
2 |
4 |

Absent,Present |
2 |
5 |

Ignoring age and fitting the conditional logistic rgeression model we have a regression coefficient equal to log(9/8) which is the log of the ratio of the overall frequencies of the two types of mismatches split by age group.

The age by disorder interaction has a chi-square(1)=0.56 which is identical to that of the likelihood ratio chi-square from a 2x2 table of the four age by disorder mismatch frequencies above obtained, for example, using the CROSSTABS procedure in SPSS. If one or more mismatches do not occur it may not be possible to estimate the conditional logistic regression model coefficients (because they are not finite).

The SPSS macro below tests the age group by disorder interaction using three age bands (under 30, 30-39 and 40 and over). Dummy variables need to be created because COXREG does not fit interaction terms directly. The (binary coded: 0=absent, 1 =present) disorder is input as an argument. The change in the chi-square test on 2 df (in the output) tests the presence of this interaction. COXREG also takes into account imperfectly age matched case-control pairs where the case's age falls in one age band and the control's in another.

DEFINE !AGEINT (!POS !TOKENS(1)). RECODE Age (30 thru 39=1) (Lowest thru 29=0) (40 thru Highest=0) INTO AGEGP3039. RECODE Age (40 thru Highest=1) (Lowest thru 39=0) INTO AGEGP40. COMPUTE AG39D = AGEGP3039*!1. COMPUTE AG40D = AGEGP40*!1. EXECUTE. COMPUTE DUPLIC=casecon. EXE. COXREG CaseCon /STATUS=DUPLIC(1) /STRATA=Pair /METHOD=ENTER AGEGP3039 AGEGP40 !1 /METHOD=ENTER AG39D AG40D /CRITERIA=PIN(.05) POUT(.10) ITERATE(20) . !ENDDEFINE. !AGEINT ANYPSYCHICDLIFETIME.

Reference

Agresti, A (1996) An introduction to categorical data analysis. Wiley: New York.