I'd like to arrange regression coefficients from multiple models with -coefplot- (available from SSC) in a way that I am convinced should be possible but I can't figure out how. Here's an example (all code in one go is enclosed at the bottom for convenience):
Code:
*ssc install coefplot // Install coefplot from SSC if necessary sysuse auto, clear // Open data generate headroomlarge = (headroom > 3) // Generate two groups ("large" and "small") of no substantive meaning
Code:
regress mpg price if headroomlarge eststo large1 regress mpg price trunk weight length if headroomlarge eststo large2 regress mpg price if !headroomlarge eststo small1 regress mpg price trunk weight length if !headroomlarge eststo small2
Code:
coefplot large* small*, keep(price)
I can stratify the plot by large and small, which is better, because the legend is decluttered by only showing the model specification (that is once you relabel it properly, sorry):
Code:
coefplot large* || small*, keep(price)
I like this version better, but it's not optimal: The y-axis is sitting basically idle while the information displayed in the y-dimension has to be deciphered using a legend? Not ideal. Is there a way to get the information from the legend onto the y-axis?
Many thanks for you consideration
KS
Code:
// Data *ssc install coefplot sysuse auto, clear gen headroomlarge = (headroom > 3) // Models regress mpg price if headroomlarge eststo large1 regress mpg price trunk weight length if headroomlarge eststo large2 regress mpg price if !headroomlarge eststo small1 regress mpg price trunk weight length if !headroomlarge eststo small2 // Figures // A coefplot large* small*, keep(price) // B coefplot large* || small*, keep(price)
0 Response to coefplot: Arranging multiple models
Post a Comment