Announcement

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

  • #16
    Originally posted by Yuliya Kazakova View Post
    but receive this error: A: invalid syntax in se()

    Do you know how to fix it?
    This works for me. I recommend that you update coefplot and try again.

    Code:
    ssc install coefplot, replace

    Comment


    • #17
      Thank you, Andrew! It worked!!
      But so weird as I installed "coefplot" only today and spent an entire day trying to fix this!
      Thanks a lot again!
      Last edited by Yuliya Kazakova; 14 May 2024, 14:21.

      Comment


      • #18
        I need help on how I can include odds ratios and confidence intervals on coefficient plots. I am only able to include odds ratios but not the confidence intervals. I used the command

        coefplot multivar, eform ci mlabel format(%9.2g) mlabposition(12) mlabsize(small) mlabgap(1) xline(1)
        Attached Files

        Comment


        • #19
          Code:
          webuse lbw, clear
          lab var smoke "Smoker"
          lab var age "Age"
          lab var ht "Hypertension"
          
          logit low age ib3.race smoke ht, or
          coefplot, eform mlab(string(@b, "%4.3f") + " ["+ string(@ll, "%4.3f") +" " + string(@ul, "%4.3f")+ "]") mlabpos(1) mlabc(black) drop(_cons)
          Res.:

          Code:
          . logit low age ib3.race smoke ht, or
          
          Iteration 0:  Log likelihood =   -117.336  
          Iteration 1:  Log likelihood = -107.84552  
          Iteration 2:  Log likelihood = -107.59459  
          Iteration 3:  Log likelihood = -107.59429  
          Iteration 4:  Log likelihood = -107.59429  
          
          Logistic regression                                     Number of obs =    189
                                                                  LR chi2(5)    =  19.48
                                                                  Prob > chi2   = 0.0016
          Log likelihood = -107.59429                             Pseudo R2     = 0.0830
          
          ------------------------------------------------------------------------------
                   low | Odds ratio   Std. err.      z    P>|z|     [95% conf. interval]
          -------------+----------------------------------------------------------------
                   age |   .9642515   .0328974    -1.07   0.286     .9018823    1.030934
                       |
                  race |
                White  |   .3434125   .1408909    -2.61   0.009     .1536725    .7674255
                Black  |   .8915044   .4429667    -0.23   0.817     .3366528     2.36083
                       |
                 smoke |   3.043852   1.144877     2.96   0.003     1.456341     6.36186
                    ht |   3.260856   2.025573     1.90   0.057     .9651256    11.01741
                 _cons |   1.004116    .809879     0.01   0.996     .2066519    4.878972
          ------------------------------------------------------------------------------
          Note: _cons estimates baseline odds.
          Click image for larger version

Name:	Graph.png
Views:	1
Size:	22.2 KB
ID:	1765320

          Comment


          • #20
            Thank you so much for your help, this really helps. Just a follow up, how can I have the odds ratios and confidence intervals to the right side of the plot as in the attached plot. I tried changing the value for example mlabpos(12) but the label values don't move to the right
            Attached Files

            Comment


            • #21
              Look at your x-axis to determine an appropriate x-position. You might need to extend the x-axis range as well. This will ensure that all labels are aligned. Otherwise, for the graph that you display, the appropriate option is -mlabgap()-. Below, the labels are set to start at x=8 and the axis is extended to x=10 (both highlighted in blue; added options highlighted in red).

              Code:
              help marker_label_options
              Code:
              webuse lbw, clear
              lab var smoke "Smoker"
              lab var age "Age"
              
              gen xpos=8
              logit low age ib3.race smoke, or 
              coefplot, eform mlab(string(@b, "%4.3f") + " ["+ string(@ll, "%4.3f") +" " + string(@ul, "%4.3f")+ "]") mlabc(none) ///
              addplot(scatter @at xpos, ms(i) mlab(@mlbl) mlabcolor(black)  mlabsize(small)) graphr(margin(r=10)) drop(_cons) xsc(r(. 10))
              Click image for larger version

Name:	Graph.png
Views:	1
Size:	24.7 KB
ID:	1765380


              Comment


              • #22
                Thank you so much. Your support is sincerely appreciated. The plots have worked out well.

                Comment

                Working...
                X