Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: plot predicted effects after regression


From   yumin sheng <shengyumin@yahoo.com>
To   statalist@hsphsun2.harvard.edu
Subject   RE: st: plot predicted effects after regression
Date   Sun, 9 May 2004 12:02:41 -0700 (PDT)

Dear Nick, Richard and Tom,

  Thanks so much to you all again. I might have been
wrong in believing that Stata has a ready command; the
"graph twoway" series seem to work only for 1 X
variable. 

Best,
yumin
--- Nick Cox <n.j.cox@durham.ac.uk> wrote:
> 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 
> . adjust headroom turn trunk length displacement,
> by(all) gen(predict) 
> . 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
> > > your reference 
> > > category, right?) and all the continuous
> covariate
> > > terms are 
> > > incorporated using their mean level. This way
> you
> > > adjust for the 
> > > 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/



	
		
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 
*
*   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index