Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- One-sided exact (Clopper-Pearson) interval

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

11-22-2013 03:32 AM

Hi!

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;

run;

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,

Oskar

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to oskarseriksson

11-25-2013 11:05 AM

The value you get for the two sided, with alpha=0.01 is equal to the one-sided alpha of 0.005. (alpha=0.1 two-tailed = 0.05 one-tailed).

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SteveDenham

11-27-2013 05:29 AM

Hi Steve!

Thank you!

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).

Best regards,

Oskar Eriksson

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to oskarseriksson

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.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SteveDenham

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.

My gratitude,

Oskar Eriksson