# RE: st: plot predicted effects after regression

 From "Nick Cox" To Subject RE: st: plot predicted effects after regression Date Sat, 8 May 2004 18:58:14 +0100

```I would be surprised if that were true.

However, it seems to me that the challenge is
not in the graphing; it is in the calculation.

You can use -adjust-: you just need to talk
your way past the requirement for a -by()-
option (unless that is part of what you want).

Here is a silly example:

. sysuse auto
. regress mpg weight headroom turn trunk length displacement
. gen all = 1
. scatter predict weight

yumin sheng

>   Thanks so much. Your solution is great, but if I
> remember correctly, I think Stata has a ready and very
> simple command for post-estimation graphing of the
> predicted effects.

Thomas Trikalinos

> > So you need predicted values on the
> > VariableOfInterest adjusting at the
> > mean level of continuous covariates, and the
> > reference category of
> > categoric covariates.
> >
> > A simple but not so elegant  solution is
> >
> > . gen PredY = Constant + beta1* VariableOfInterest1
> > +
> > beta2*MeanContinuousCovariate2   (or the
> > corresponding analogue for a
> > logit/probit/poisson etc regression)
> >
> > [first run . egen MeanContinuousCovariate2 =
> > mean(ContinuousCovariate2)]
> >
> > Constant and beta1, beta2 are from the regression
> > output. All
> > Categorical covariate terms are zero (this would be
> > category, right?) and all the continuous covariate
> > terms are
> > incorporated using their mean level. This way you
> > reference category for categoric covariates and for
> > the mean value of
> > continuous covariates.
> >
> > You most probably have more than one continuous
> > covariates; just put in
> > as many terms as you need. If you have different
> > functions of the
> > VariableOfInterest (eg quadratic or cubic terms) put
> > them in as more
> > VariablesOfInterest.
> >
> > This is a crude workaround I use. I'm confident that
> > people know
> > something better and more elegant, though...

*
*   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/
```