Bookmark and Share

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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Confidence interval for proportions


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Confidence interval for proportions
Date   Mon, 10 Mar 2014 16:03:36 +0000

At least some of the methods used reduce to one-line computations, so e.g.

. cii 50 31, jeffreys

                                                         ----- Jeffreys -----
    Variable |        Obs        Mean    Std. Err.       [95% Conf. Interval]
-------------+---------------------------------------------------------------
             |         50         .62     .068644        .4818115     .744739

corresponds to

. di invibeta(31 + 0.5,  50  - 31 +0.5, 0.025)
.48181148

. di invibeta(31 + 0.5,  50  - 31 +0.5, 0.975)
.74473897

So, in this case, suppose you have variables n and k. Then

gen ub = invibeta(k + 0.5, n - k + 0.5, 0.975)

will calculate upper bounds of 95% confidence intervals for all
observations in one command.

I raise a flag that an assumption here is that the observations are
independent of each other.

But -- in short -- this is eminently programmable.

Nick
[email protected]


On 10 March 2014 15:51, Peter Jansen <[email protected]> wrote:
> I am look for a way to generate binomial confidence intervals for a database containing time / event data. Database looks like:
>
> events   time   lcl  ucl
> 1   100
> 2 150
> etc.
>
> One could obviously use the cii command, but in that case one needs to calculate it manually for each observation. The ci command calculates the confidence interval for the whole variable.
>
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index