Announcement

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

  • How to plot only interaction terms in coefplot

    I have four regressions and I am trying to plot only the coefficients of the interaction terms, using coefplot.

    Code:
    sysuse auto, clear
    
    reg price c.turn##i.foreign, r
    eststo m4
    reg price c.weight##i.foreign, r
    eststo m3
    reg price c.headroom##i.foreign, r
    eststo m2
    reg price c.mpg##i.foreign, r
    eststo m1
    
    coefplot (m1,label("Mileage")) (m2,label("Headroom")) (m3,label("Weight")) (m4,label("Turn")), keep(c.turn##i.foreign c.weight##i.foreign c.headroom##i.foreign c.mpg##i.foreign) vertical
    When I run the do-file Stata stops before plotting the coefplot and types:

    coefplot (m1,label("Mileage")) (m2,label("Headroom")) (m3,label("Weight")) (m4,label("Turn")), keep(c.turn##i.foreign c.weight##i.foreign c.headroom##i.fo
    > reign c.mpg##i.foreign) vertical
    (m1: no coefficients found, all dropped, or none kept)
    (m2: no coefficients found, all dropped, or none kept)
    (m3: no coefficients found, all dropped, or none kept)
    (m4: no coefficients found, all dropped, or none kept)
    (nothing to plot)
    Is there a solution or any other way to this? It works when I want to plot the independent variables (i.e. turn weight headroom mpg).
Working...
X