Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: regress and then extrapolate with new dependent vars but same coefficients


From   Richard Williams <[email protected]>
To   [email protected]
Subject   Re: st: regress and then extrapolate with new dependent vars but same coefficients
Date   Wed, 19 Jul 2006 11:12:34 -0500

At 09:56 AM 7/19/2006, Olga Gorbachev Melloni wrote:
Hello,

I need to run an exercise in which after running a regression and predicting the y_hat, I need to replace one of the dependent variables with zeros and then use the saved coefficients to predict a hypothetical value for y_hat(given x1==0), in order to compare the predicted values from these two exercises.

Does any one know how to do this quickly, without saving all the coefficients and manually predicting for the second step? I am running a regression with 174 dependent variables (mostly dummies) and it would take some time to predict manually.

I've checked on the faq for this and was unable to find anything, i might have overlooked the answer and apologize in advance if it has been asked and answered already and would appreciate any references if so.
One way is to use the adjust command.

reg y x1 x2 x3
predict yhat1
adjust x1=0, gen(yhat2)

Another way:

clonevar newx1 = x1
reg y newx1 x2 x3
predict yhat1
replace newx1 = 0
predict yhat2


-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc
*
* 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index