Announcement

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

  • Confidence Interval for binomial test in Stata

    I don't know if this question makes sense but I'll give it a try..

    In Group A, 15 out of 40 patents have a good outcome (outcome can be either good or bad). The comparison group's "good" rate is 0.243.

    So I did a binomial test to see if the difference is significant.

    Per the one-sided test, it is:



    . bitesti 40 15 0.243

    N Observed k Expected k Assumed p Observed p
    ------------------------------------------------------------
    40 15 9.72 0.24300 0.37500

    Pr(k >= 15) = 0.043511 (one-sided test)
    Pr(k <= 15) = 0.979716 (one-sided test)
    Pr(k <= 4 or k >= 15) = 0.063801 (two-sided test)


    But the 95% Conf. Interval is calculated as follows:


    . cii 40 15

    -- Binomial Exact --
    Variable | Obs Mean Std. Err. [95% Conf. Interval]
    -------------+---------------------------------------------------------------
    | 40 .375 .0765466 .2272627 .5419852


    Shouldn't it be the case that 0.243 should be outside of the 95% Conf. Interval of [.2272627, .5419852]?


  • #2
    First off, this is hard to read; see pt. 12 of the FAQ, especially the section on code tags. Also, your cii command generates an error in Stata 14.1. If you are aren't using the most current version of Stata please say what you are using. Here is your output in a more easy to read way:

    Code:
    . bitesti 40 15 0.243
    
            N   Observed k   Expected k   Assumed p   Observed p
    ------------------------------------------------------------
           40         15         9.72       0.24300      0.37500
    
      Pr(k >= 15)           = 0.043511  (one-sided test)
      Pr(k <= 15)           = 0.979716  (one-sided test)
      Pr(k <= 4 or k >= 15) = 0.063801  (two-sided test)
    
    . version 13: cii 40 15
    
                                                             -- Binomial Exact --
        Variable |        Obs        Mean    Std. Err.       [95% Conf. Interval]
    -------------+---------------------------------------------------------------
                 |         40        .375    .0765466        .2272627    .5419852
    As for your Q I don't think this is that unusual. There are a bunch of ways to compute CIs for binary variables (see the help for cii). There was some discussion of this several years ago on Statalist:

    http://www.stata.com/statalist/archi.../msg00176.html

    Start with that post and see the several followup posts after that. I tried to summarize (perhaps incorrectly) some of the highlights on pp. 3-4 of

    http://www3.nd.edu/~rwilliam/stats1/x23.pdf

    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      I don't know the answer to the question you posed.

      But let me challenge your context. By using -bitesti- you are taking the comparison group's good rate, 0.243, as a known constant rather than a random variable. Well, if that constant is derived mathematically, or represents some law of nature, or is a decision threshold value derived from a decision analysis, or was estimated in a really enormous sample so that its standard error is somewhere in the 10^-6 range or smaller, then that's OK. But if the 0.243 itself comes from a typical research study sized sample, it isn't appropriate to treat it as constant. You should, in most contexts, instead be comparing the group good outcome rates on an equal footing, for example, with a cross tabulation of group and outcome and a chi square test, or -prtest outcome, by(group)-. Is there something in your setting, or in your research goals, that justifies treating the comparison group's good outcome rate as a fixed, known constant not, itself, subject to sampling error?

      Comment

      Working...
      X