Announcement

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

  • Coefplot: how to display only certain variables?

    Hi everyone,
    I want to use coefplot just to display the coefficients of two categorical variables holding for all the others after a reg.
    I have saved the output of the regression with est store and then I use coefplot...this is the script
    reg umeat0 i.soclas6 i.titstu1 i.civstat1 i.ripgeo1 i.eta1 i.sex i.bmi1
    est store meat1
    coefplot meat1, drop(_cons)
    I see that in this manner I take out the constant term from the plot...but when I add other variables inside brackets the plot still shows them all. I would like to have a graph with just i.soclas6 and i.titstu1 .
    Can you help me? I guess it's easy, but I really don't know how to do that.

  • #2
    I would like to have a graph with just i.soclas6 and i.titstu1 .
    Try

    Code:
    coefplot meat1 ,keep(*.soclas6 *.titstu1)
    Best
    Daniel

    Comment


    • #3
      coefplot meat1, drop(_cons || 0.civstat1 || 1.civstat1 || 0.ripgeo1 || 1.ripgeo1 || 0.eta1 || 1.eta1 || 0.sex || 1.sex || 0.bmi1 || 1.bmi1)

      OR

      coefplot meat1, keep ( 1.soclas6 || 1.titstu1)


      Comment


      • #4
        I am having the same problem. The * solution that Daniel suggested seems to have solved the solution.

        Comment


        • #5
          Ahh...you need to know what Stata calls each variable in the model. You can look under the hood using the coeflegend option to regress or logit. Try this example and see if this gets you closer:

          sysuse auto, clear
          logit foreign i.rep78 if rep78 >=3, coeflegend
          coefplot, keep(_cons 4.rep78 5.rep78)


          Best,
          Alan

          Comment

          Working...
          X