[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: graphs linear regressions with dummies
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:
reg price mpg fore
replace fore = 1 if fore == 0
label var fit_fore "Foreign"
replace fore = 0 if fore == 1
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,
----- Original Message -----
Date: Tuesday, November 9, 2004 6:45 am
Subject: st: graphs linear regressions with dummies
> 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 ?
* For searches and help try: