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

# st: Re: Simplification of mata syntax to determine CI possible?

 From Dirk Enzmann To statalist@hsphsun2.harvard.edu Subject st: Re: Simplification of mata syntax to determine CI possible? Date Wed, 06 Jul 2011 15:31:08 +0200

In reply to Nick ( http://www.hsph.harvard.edu/cgi-bin/lwgate/STATALIST/archives/statalist.1107/date/article-184.html ):
```
Yes,

pp = range(0.000001,0.999999,1/99999)

```
is a dodgy thing the do but this it not essential - I did it to compare the results experimentally to another routine where I used a vector of 100,000 rows. Of course, you could work with 100,001 rows and use
```
pp = range(0,1,.00001)

```
And yes, I read the Brown et al. (2001) paper. As to the likelihood ratio interval they write (p. 114): "Brown, Cai and DasGupta (1999) show by analytical calculations that this interval has nice properties. However, it is slightly harder to compute." (unfortunately their reference to Brown et al., 1999, is lacking).
```
```
Because -ci- lacks this type of interval, I tried it on my own. Ultimately, I would like to be able to replicate the examples given by Brown et al. (2001) using Stata instead of the R (see:
```
http://www2.jura.uni-hamburg.de/instkrim/kriminologie/Mitarbeiter/Enzmann/Software/prop.CI.r

and

http://www2.jura.uni-hamburg.de/instkrim/kriminologie/Mitarbeiter/Enzmann/Software/ex_prop.CI.r

```
). However, as I said, I would like to know whether it is possible to replace the 13 lines of mata by something more efficiently as the one line I used in the R function. Or if there is an even better approach to construct the likelihood ratio confidence interval using Stata.
```
References:
```
Brown, L.D., Cai, T.T., & DasGupta, A. (2001). Interval estimation for a binomial proportion. Statistical Science, 16(2), 101-133.
```
========================================
Dirk Enzmann
email: dirk.enzmann@uni-hamburg.de
========================================
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```