Announcement

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

  • Can one-proportion z-interval procedure be used to this condition?

    Hello, guys

    One-proportion z-interval procedure could be used to compute the confidence interval of observations either has or does not have a specific attribute (0 or 1). However, the specific attribute of my samples has more than 2 options. Is is appropriate to use one-proportion z-interval procedure to compute the confidence interval? Thanks.

  • #2
    No, you cannot use this approach. If the attribute is no dichotomous, then you need to create indicator variables for each level of the attribute and then calculate the proportion and confidence interval separately for each of those.

    For example:
    Code:
    . sysuse auto
    (1978 Automobile Data)
    
    //    THIS NEXT COMMAND IS ILLEGAL AS REP78 TAKES ON 5 VALUES
    //    SURPRISINGLY, STATA DOES NOT THROW AN ERROR MESSAGE
    //    AND JUST LEAVES THE OUTPUT BLANK!
    . ci proportion rep78
    
                                                             -- Binomial Exact --
        Variable |        Obs  Proportion    Std. Err.       [95% Conf. Interval]
    -------------+---------------------------------------------------------------
    
    //    AND, UNFORTUNATELY, CI PROPORTION DOES NOT SUPPORT
    //    FACTOR VARIABLE NOTATION
    . ci proportion 2.rep78
    factor-variable and time-series operators not allowed
    r(101);
    
    //    SO WE HAVE TO CREATE OUR OWN INDICATOR VARIABLES
    . tab rep78, gen(rep78)
    
         Repair |
    Record 1978 |      Freq.     Percent        Cum.
    ------------+-----------------------------------
              1 |          2        2.90        2.90
              2 |          8       11.59       14.49
              3 |         30       43.48       57.97
              4 |         18       26.09       84.06
              5 |         11       15.94      100.00
    ------------+-----------------------------------
          Total |         69      100.00
    
    //    AND THEN WE CAN LOOP OVER THOSE AND GET
    //    PROPORTIONS FOR EACH WITH ITS CONFIDENCE INTERVAL
    . foreach v of varlist rep78?* {
      2.     ci proportion `v'
      3. }
    
                                                             -- Binomial Exact --
        Variable |        Obs  Proportion    Std. Err.       [95% Conf. Interval]
    -------------+---------------------------------------------------------------
          rep781 |         69    .0289855    .0201966        .0035298    .1008154
    
                                                             -- Binomial Exact --
        Variable |        Obs  Proportion    Std. Err.       [95% Conf. Interval]
    -------------+---------------------------------------------------------------
          rep782 |         69     .115942    .0385422        .0514066    .2157325
    
                                                             -- Binomial Exact --
        Variable |        Obs  Proportion    Std. Err.       [95% Conf. Interval]
    -------------+---------------------------------------------------------------
          rep783 |         69    .4347826    .0596787        .3157646    .5595791
    
                                                             -- Binomial Exact --
        Variable |        Obs  Proportion    Std. Err.       [95% Conf. Interval]
    -------------+---------------------------------------------------------------
          rep784 |         69    .2608696    .0528625        .1625161    .3805962
    
                                                             -- Binomial Exact --
        Variable |        Obs  Proportion    Std. Err.       [95% Conf. Interval]
    -------------+---------------------------------------------------------------
          rep785 |         69    .1594203    .0440694        .0823622    .2673681
    
    .

    Comment

    Working...
    X