Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • invbinomial(), cci proportions, and confidence intervals

    I'm puzzled:
    Code:
    . version 18 : display invbinomial(10,4,.025)
    .73762192
    
    . version 18 : display invbinomial(10,4,1-.025)
    .18708603
    
    . version 9 : display invbinomial(10,4,.025)
    .12155226
    
    . version 9 : display invbinomial(10,4,1-.025)
    .73762192
    
    . version 18 : cii proportion 10 4
    
                                                                Binomial exact  
        Variable |        Obs  Proportion    Std. err.       [95% conf. interval]
    -------------+---------------------------------------------------------------
                 |         10          .4    .1549193        .1215523    .7376219
    
    . version 9 : cii 10 4
    
                                                                Binomial exact  
        Variable |        Obs        Mean    Std. err.       [95% conf. interval]
    -------------+---------------------------------------------------------------
                 |         10          .4    .1549193        .1215523    .7376219
    The behavior of invbinomial() has been changed from Stata 9 to Stata 10. The respective entry in whatsnew9to10 says:
    [...]
    d. invbinomial(n, k, p), [...] are more accurate for small values of p or for returned values close to zero.
    implying that results from Stata 18 should be "better". Yet, cii still uses ancient results from before Stata 10. Why? And, should I or should I not use the modern, "improved" invbinomial()?


    Edit: Title should say cii not cci (a related command) sorry.
    Last edited by daniel klein; 01 May 2025, 02:14.

  • #2
    Private conversation with Mike Lacy made me realize I missed a very basic point: The binomial distribution isn't symmetric (unless P=.5). Therefore
    Code:
    invbinomial(10,4,1-.025)
    is not supposed to match
    Code:
    invbinomialtail(10,4,.975)
    This makes all the difference when constructing confidence intervals. Older versions of Stata didn't have invbinomialtail(), and invbinomial() switched tails automatically for P>=.5.

    cii's confidence intervals were and still are accurate.

    [edit]
    To spell things out, the upper bound should be obtained as
    Code:
    invbinomial(10,4,.025)
    and the lower bound as
    Code:
    invbinomialtail(10,4,.025)
    [/edit]

    Sorry for the confusion. Hopefully, this post helps others avoid the same mistake.
    Last edited by daniel klein; 02 May 2025, 13:27.

    Comment

    Working...
    X