In R, how is a "conditional MLE" calculated for the odds ratio of an exact McNemar test? In R, if I use the function mcnemar.exact from the exact2x2 package for my data set I get the following results:
    Exact McNemar test (with central confidence intervals)

data:  Matrix.3
b = 7, c = 12, p-value = 0.3593
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
 0.1945802 1.6070322
sample estimates:
odds ratio 
 0.5833333

My question is: how was the odds ratio at the bottom calculated? I looked it up in the docs for the exact2x2 library and it says: "an estimate of the odds ratio. Note that the conditional Maximum Likelihood Estimate (MLE) rather than the unconditional MLE (the sample odds ratio) is used."
But no equation is provided.
What equation yielded the value 0.5833333?

Ok. First, note b = 7, c = 12 in the output
Second, note that 7/12=0.5833333.
In a $2\times 2$ table of matched binary data with cells labelled $a$, $b$, $c$, $d$, the ratio $b/c$ of the two off-diagonal cells is the Mantel-Haenszel estimate of the odds ratio.  For matched-pair data, this is also the conditional MLE.
In general, there's no straightforward formula for the conditional MLE, it's just the number that maximises the conditional likelihood, which is a complicated sum over all sets of possible tables agreeing with the observed margins.
