Announcement

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

  • Coefplot with bycoefs option: how to relabel models

    Hi everyone,

    I am trying to plot coefficients of several models by using the coefplot command and the bycoefs option.

    I would like to rename the model labels (in the example below from m1 m2 m3 to e.g. overall, domestic, foreign). See below for a reproducible example with code and output.

    I tried several commands that are mentioned in the help file and on the website (http://repec.sowi.unibe.ch/stata/coefplot/index.html), but failed so far. Obviously, I could rename how the estimates are stored, but I would like to use labels with spaces.

    If anyone knows how to do this, it would be of great help.

    Thanks


    Code:
    sysuse auto, clear
    
    reg price mpg headroom weight turn
    estimate store m1
    
    reg price mpg headroom weight turn if foreign==0
    estimate store m2
    
    reg price mpg headroom weight turn if foreign==1
    estimate store m3
    
    coefplot m1 || m2 || m3, keep(turn weight) yline(0) bycoefs  byopts(yrescale) vertical
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	59.9 KB
ID:	1562745

  • #2
    coefplot is from Stata Journal. Thanks for the reproducible example. The first coefficient is identified by 1 in the x-axis, so you want to add the option

    Code:
    xlab(1 "overall" 2 "domestic" 3 "foreign")
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	33.3 KB
ID:	1562758

    Comment

    Working...
    X