harrelfe / Hmisc

Harrell Miscellaneous
Other
204 stars 81 forks source link

Wilson CI's when x = 1 and x = n-1 using binconf #139

Open bkwrmacb opened 3 years ago

bkwrmacb commented 3 years ago

In the binconf code there are adjustments that are made when x = 1 or x = n-1 as follows

if (x == 1) 
  cl[1] <- -log(1 - alpha)/n
if (x == (n - 1)) 
  cl[2] <- 1 + log(1 - alpha)/n

If possible could I please get the reference/justification for the deviation from the Wilson confidence interval calculation? I was unable to find a reference to support this. Thank you for any help or resources!

harrelfe commented 2 years ago

See if it's here: http://hbiostat.org/papers/inference/agr00sim.pdf

Newcombe's preferred method is implemented in the R Epi package in the ci.pd function (it's default method). Agresti and Caffo's method is the other implemented method.