To follow up my previous posting, you
can do this with less typing (and without changing
your existing variables)
sysuse auto,clear
reg price mpg fore
predict fit
separate fit, by(foreign) veryshortlabel
twoway line fit? mpg, clcolor(blue green)
ytitle(Predicted Price)
The -veryshortlabel- option is undocumented,
but helpful here.
Nick
[email protected]
[email protected]
> One way would be to replace dummy values before the fitted
> values are generated.
>
> Here is an example of generating fitted values for different
> values of foreign:
>
> sysuse auto,clear
> reg price mpg fore
> replace fore = 1 if fore == 0
> predict fit_foreign
> label var fit_fore "Foreign"
> replace fore = 0 if fore == 1
> predict fit_domestic
> label var fit_dom "Domestic"
> twoway (line fit_foreign mpg, clcolor(blue) clwidth(medium)
> ytitle(Predicted Price)) ///
> (line fit_domestic mpg, clcolor(green) clwidth(medium))
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/