Announcement

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

  • problems with coefplot


    Dear Statalist,
    I am quite a new Stata user. I need to plot regressions coefficients + ci of different models. I have been trying with coefplot.

    My syntax was:

    coefplot, keep(x4) xline (0)

    or, alternatively

    coefplot, drop(?cons x1 x2 x3) xline(0)

    but I had two problems:
    1. I only get on the graph the coefficients, but not the ci.
    2. With keep, Stata says that I have kept no variable, with drop, Stata drops _cons x1 x2, but not x3.

    x1 and x2 are dummy variables, while x3 and x4 are categorical.

    Thank you very much

  • #2
    n.b., -coefplot- is from SSC.

    Consider the MWE below and let us know what about this example is not producing the (your) expected result. This seems to replicate the data you describe and produce the results you say the plot is not producing::


    Code:
    sysuse auto, clear
    
    ssc install coefplot, replace
    g foreign2 = cond(price<15000, 0, 1, .)
    regress mpg i.foreign i.foreign2 i.rep78 i.turn
    coefplot , keep(turn) xline(0) ci
    coefplot, drop(?cons foreign foreign2 rep78) xline(0) ci
    Alternatively, please provide some code (and possibly the regression output) if you are still having issues.

    - Eric Booth

    Eric A. Booth | Senior Director of Research | Far Harbor | Austin TX

    Comment


    • #3
      Dear Eric ,

      I have used your coding and solved the problem with the ci. Unfortunately, I still get this message:

      coefplot , keep(turn) xline(0) ci
      (.: no coefficients found, all dropped, or none kept)
      (nothing to plot)

      and the drop only drop the constant....

      Comment


      • #4
        If you refer to factor variables, use factor variable notation:
        Code:
        coefplot , keep(*.turn) xline(0) ci
        coefplot, drop(?cons *.foreign *.foreign2 *.rep78) xline(0) ci

        Comment


        • #5
          Thank you very much, now everything works!!!

          Comment

          Working...
          X