11-22-2013 03:32 AM
I have a small problem when it comes to computing one-sided clopper-pearson confidence intervals for a binomial proportion.
I have 1007 failures (coded 0) and 1 success (coded 1) in a dataset. I want an exact one-sided upper confidence limit for the success.
This is the code I used so far.
proc freq data=x;
tables y / alpha=.01 binomial exact cl;
Nothing complicated, but I've browsed the web for a while now and I can't find where I'm supposed to type what in order to get a one-sided interval instead of a two-sided. I managed to get a one-sided interval with some other code, but I wasn't sure that it was a Clopper-Pearson interval and therefore I could not use it. And it's really important that I obtain a Clopper-Pearson interval.
Thanks for helping out,
11-27-2013 05:29 AM
That's correct, but it doesn't quite solve my problem entirely. The main reason is that the two-sided interval with half the alpha-value returns a wider interval than necessary.
So I'd very much appreciate a way to code a one-sided interval instead. And it needs to be an exact interval (i.e. Clopper-Pearson).
12-03-2013 10:51 AM
There may be a problem with coverage in an exact interval. In the documentation for PROC FREQ (Detailstatistical Computations:Binomial Proportions), there is a statement that the confidence interval is conservative and unless the sample size is large, the actual covarage probability can be much larger thatn the target. So, because this becomes a discrete problem, you may be getting a wider interval than you might expect--the boundary HAS to be defined by some integer value m such that prob(m/N)>=alpha.
Also, it gives the formulas for calculating the boundaries, and you can see that for a 95% interval (two-sided), it plugs in alpha/2 = 0.025. Thus a 90% interval two sided will give a one-sided bound because the Clopper-Pearson interval is constructed by inverting the equal-tailed test. It's just bigger than you might expect due to the granularity of the data.
12-04-2013 02:37 AM
Now I feel a bit stupid! How did I not consider the option to go for a wider two-sided?!
Regarding the coverage probability exceeding 1-alpha, that is sort of important for this particular inference given the sensitive context the results will be used in.
Thanks for walking me around the obstacle! Maybe someday there'll be a possibility to code a one-sided more easily.