I'm having trouble getting marginsplot to generate a particular bar graph of predicted values that seems like it shouldn't be that hard. Here's a stylized example:
sysuse auto
reg price c.mpg##foreign
margins ,at(mpg=(20 30 40) foreign=(0 1)) vsquish
I can get two bar graphs for my three values of mpg (one for foreign=0 and one for foreign=1) to print side-by-side with this:
marginsplot ,x(mpg) recast(bar) by(foreign)
But what I really want is two bars for each value of mpg where the left is for foreign=0 and the right is foreign=1. I thought this would work, but it definitely does not:
marginsplot ,x(mpg) recast(bar) plotopts(over(foreign))
option over() not allowed
Any ideas would be much appreciated.
Thanks,
Doug
---------------
Douglas McKee
Associate Chair and Senior Lecturer, Economics
Lecturer, School of Medicine
Yale University
[email protected]
http://dougmckee.net
http://teachbetter.co
http://highvariance.net
310-266-2438
sysuse auto
reg price c.mpg##foreign
margins ,at(mpg=(20 30 40) foreign=(0 1)) vsquish
I can get two bar graphs for my three values of mpg (one for foreign=0 and one for foreign=1) to print side-by-side with this:
marginsplot ,x(mpg) recast(bar) by(foreign)
But what I really want is two bars for each value of mpg where the left is for foreign=0 and the right is foreign=1. I thought this would work, but it definitely does not:
marginsplot ,x(mpg) recast(bar) plotopts(over(foreign))
option over() not allowed
Any ideas would be much appreciated.
Thanks,
Doug
---------------
Douglas McKee
Associate Chair and Senior Lecturer, Economics
Lecturer, School of Medicine
Yale University
[email protected]
http://dougmckee.net
http://teachbetter.co
http://highvariance.net
310-266-2438
Comment