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))
Hope this helps,
Scott
----- Original Message -----
From: [email protected]
Date: Tuesday, November 9, 2004 6:45 am
Subject: st: graphs linear regressions with dummies
> Hi,
>
> I am trying to graph a two-way plot of a dependent and an explanatory
> variable together with a fitted line, where the line is fitted
> with a
> linear regression containing two dummy variables. When I do, the
> fittedline doesn't come out linear, but incorporates the fitted
> values of the
> observations where the dummies are 1. The only way I found of how
> to make
> the fitted line look linear is to exclude from the graph the two
> observations where the dummies are 1. Anyone know of a more
> elegant/efficient way ? Viz. what I find puzzling is that the two
> dummiesare screwing up the linear graph of the fitted line, but
> the individual
> fixed effects which I also have in the regression are not ?
>
> Thanks
> Ralph
>
*
* 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/