1

I am performing a McNemar test in R of the following data:

enter image description here

Obtaining the following result:

enter image description here

I understand the results, nevertheless, someone could explain to me how the confidence interval is computed?

StupidWolf
  • 45,075
  • 17
  • 40
  • 72
Sss
  • 427
  • 2
  • 8

1 Answers1

1

You can read it more in this vignette and also check out the code. Using this wiki picture for illustration:

enter image description here

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.

StupidWolf
  • 45,075
  • 17
  • 40
  • 72