I have the following data:
> Performance = as.table(rbind(c(794,150),c(86,570))
> Performance
A B
A 794 150
B 86 570
I perform an Exact McNemar test in R, obtaining the following result:
> library(exact2x2)
> mcnemar.exact(Performance)
Exact McNemar test (with central confidence intervals)
data: Performance
b = 150, c = 86, p-value = 3.716e-05
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
1.329228 2.300979
sample estimates:
odds ratio
1.744186
I understand the results, nevertheless, someone could explain to me how the confidence interval is computed?
You can read it more in this vignette and also check out the code. Using this wiki picture for illustration:
The odds ratio is b / c, which in your case works out to be 150/86 = 1.744186
. You can construct a binomial confidence interval around the proportion of successes, treating b as success and number of trials to be b + c.
In the code, they used this bit of code to calculate:
library(exactci)
CI = binom.exact(150,86+150,tsmethod = "central")
CI
data: 150 and 86 + 150
number of successes = 150, number of trials = 236, p-value = 3.716e-05
alternative hypothesis: true probability of success is not equal to 0.5
95 percent confidence interval:
0.5706732 0.6970596
sample estimates:
probability of success
0.6355932
You have the upper and lower bound of b, then odds ratio is p / 1- p :
CI$conf.int/(1-CI$conf.int)
[1] 1.329228 2.300979
The vignette for binom.exact states:
The 'central' method gives the Clopper-Pearson intervals, and the 'minlike' method gives confidence intervals proposed by Stern (1954) (see Blaker, 2000).
So this is one of the many methods of estimating a binomial confidence interval.