Announcement

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

  • Stata code for finding Median odds ratio (MOR) for a survey multilevel mixed effects logistic regression model

    Hi everyone. I am new here.
    I am doing a survey multilevel mixed effects logistic regression model. I have 4 models. The null model, a model with individual level variables, a model with community level variables and a model with both the individual and community level variables.
    I already have my models, however, I am trying to find the MOR of the following model using the following commands:

    * Model 2 (Individial level variables with p-values<0.2)
    svy: melogit n_d ib2.marital_status i.mat_educ i.wealth_index ib2.birthweight ib2.birthtype i.b_order ib3.anc_timing ib2.PNC_attendant || v001:
    estimates store model2

    * Median odds-ratio (MOR)
    nlcom exp(sqrt(2*_b[var(_cons[v001]):_cons])*invnormal(0.75)), cformat(%9.2f)

    This is giving me the following error:
    "var(_cons[v001]) not found"


    Can someone please help me?
    I am using stata 16.
    Thanks



  • #2
    Run

    Code:
    svy: melogit n_d ib2.marital_status i.mat_educ i.wealth_index ib2.birthweight ///
    ib2.birthtype i.b_order ib3.anc_timing ib2.PNC_attendant || v001:, coeflegend
    to see how the coefficient is named. I think melogit adds a forward slash:


    Code:
    _b[/var(_cons[v001])]

    Comment


    • #3
      Thank you Andrew but the slash seems not to be working again

      Comment


      • #4
        This works for me in Version 16.

        Code:
        webuse nhanes2f, clear
        svyset psuid, strata(stratid)
        qui sum zinc, d
        gen hizinc= zinc> `r(p50)'
        g v001= psuid
        svy: melogit hizinc age weight female black orace rural|| v001:
        nlcom exp(sqrt(2*_b[/var(_cons[v001])])*invnormal(0.75)), cformat(%9.2f)
        Res.:

        Code:
        . 
        . nlcom exp(sqrt(2*_b[/var(_cons[v001])])*invnormal(0.75)), cformat(%9.2f)
        
               _nl_1:  exp(sqrt(2*_b[/var(_cons[v001])])*invnormal(0.75))
        
        ------------------------------------------------------------------------------
              hizinc |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
               _nl_1 |       1.09       0.00   295.61   0.000         1.09        1.10
        ------------------------------------------------------------------------------

        Comment

        Working...
        X