Announcement

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

  • coefplot multiple models with labeling

    Dear Stata gurus

    I am trying to label the output of coefplot from multiple models rather unsuccessfully. Consider the code below:

    sysuse auto, clear
    xtile tg = turn, n(5)

    local covars "mpg trunk length"
    est clear
    foreach i in 1 2 3 4 5{
    di "`i'"
    eststo: qui regress price `covars' if tg == `i'
    }
    coefplot est1 est2 est3 est4 est5, drop(_cons) yline(0) vertical keep(mpg)

    This produces a graph with the x-axis labelled Mileage and the model names in the legend. I am hoping to instead suppress the legend and label the models with their names on the xais as 1 2 3 4 5 and the xtitle itself to be "Quartiles of Turn". While adding xttitle("Quartiles of Turn") works, it still doesn't suppress the label for mpg and I am still unable to get the model names (1 2 3 4 5) on the xaxis.

    Would be grateful for your suggestions.

  • #2
    Okay, I finally found: https://www.statalist.org/forums/for...ultiple-models and my solution to the problem as well:

    coefplot (est1, aseq("1")) (est2, aseq("2")) (est3, aseq("3")) (est4, aseq("4")) (est5, aseq("5")), keep(mpg) yline(0) vertical aseq swapnames xtitle(Quartiles of Turn)

    Comment

    Working...
    X