Announcement

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

  • 95% confidence interval with invlogit

    Greetings,
    I'm having a problem analysing my dataset. I'm trying to get the prevalence and 95% CI using invlogit after logit, stratified by age group. The code I used for the first age group worked perfectly fine:
    Code:
          . svy: logit disease i.agegroup
    
    i.agegroup        _Iagegroup_1-4      (naturally coded; _Iagegroup_1 omitted)
    
    Multiple-imputation estimates (svy: logit)               Imputations =      20
    Survey: Logistic regression                              Minimum obs =   61763
                                                             Minimum dof =    28.1
    
    ------------------------------------------------------------------------------
     disease  |     Coef.     Std. Err.      t       P>|t|      [95% Conf. Int.]      FMI
    -------------+----------------------------------------------------------------
    _Iagegroup_2 |   1.17125   .662175    1.77   0.086   -.172402   2.5149       0.392
    _Iagegroup_3 |   1.51965   .643212    2.36   0.025    .202209  2.83708      0.484
    _Iagegroup_4 |   1.91023    .63209    3.02   0.005     .61969   3.20078       0.455
          _cons  |  -7.37062   .652405  -11.30   0.000   -8.69879  -6.04245   0.427
    ------------------------------------------------------------------------------
    
    . di 100000*invlogit(_b[_cons])
    62.907951
    
    . di 100000*invlogit(_b[_cons] - invnormal(0.975)*_se[_cons])
    17.521634
    
    . di 100000*invlogit(_b[_cons] + invnormal(0.975)*_se[_cons])
    225.59326
    The code above resulted in the prevalence of the disease in age group 1 and its 95% CI
    However, I'm stuck trying to estimate the 95% CI of other age groups. My code is like this:
    Code:
    . di 100000*invlogit(_b[_cons] + _b[_Iagegroup_4])
    202.65838
    
    . di 100000*invlogit(_b[_cons] + _b[_Iagegroup_4] - invnormal(0.975)*(_se[_cons] + _se[_Iagegroup_4]))
    15.438546
    
    . di 100000*invlogit(_b[_cons] + _b[_Iagegroup_4] + invnormal(0.975)*(_se[_cons] + _se[_Iagegroup_4]))
    2601.186
    The above 95% CI looks ridiculously wrong. Can anyone help me with the correct code to get the 95% CI for other age groups? I'm using Stata 14.2. Thank you very much!

    Best regards,
    Hain
    Last edited by Hain Nguy; 26 Aug 2019, 05:11.

  • #2
    You're doing this the hard way. Look at margins.

    Comment


    • #3
      Have you looked at mimrgns by Daniel Klein, on SSC?

      Comment

      Working...
      X