Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: prtest confidence interval

 From Steve Samuels To statalist@hsphsun2.harvard.edu Subject Re: st: prtest confidence interval Date Sat, 10 Nov 2012 23:08:45 -0500

```The Manual entry for -prtest- shows the formula that it uses the normal
approximation. This approximation doesn't "know" that the binomial CIs
should be in [0,1]. Also the confidence intervals based on the
approximation are bad unless "n" is large, especially for high and low
values of the unknown probability (Brown et al., 2001). So the answer to

For CIs, the "exact" confidence intevals (Clopper-Pearson) are very
conservative. (Agresti & Coul, 1998). I recommend -ci- with the
-binomial- and -agresti- option. Also, if you are interested in a test
p-value, run -bitest- with the -detail- option and construct your own
mid-p-value (Agresti, 2002, p. 20) using the returned results

Steve

Agresti, A., and B.A. Coull. 1998. Approximate is better than “exact”
for interval estimation of binomial proportions. The American
Statistician 52, no. 2: 119-126.

Agresti, A. 2002. Categorical data analysis. Hoboken, NJ:
Wiley-interscience.

Brown, L.D., T.T. Cai, and A. DasGupta. 2001. Interval estimation for a binomial proportion. Statistical Science 101-117.
available at: http://www.ic.unicamp.br/~wainer/cursos/2s2009/1009213286.pdf

Steve

On Nov 10, 2012, at 4:17 PM, Kenneth A Knapp wrote:

For a binary variable, to get a confidence interval I include the "binomial" option:
ci variable, binomial
(variable is  the name of a binary variable)

Trouble is, when I exectute:
prtest variable==X
(X is a number between 0 and 1)
the reported confidence interval doesn't match the interval obtained from "ci variable, binomial"
Rather, the reported confidence interval is the same as I get when I execute "ci viariable" -- that is, the ci command without the "binomial" option.

A particular binary variable I am working with has an upper bound confidence interval > 1 when I execute "ci" without the binomial option.

Any way to correct prtest so that the confidence intervals reported match those you get when you execute ci with the binomial option?
Is such a correction even needed?

Any help would be very much appreciated.
Ken K
Seton Hall
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```