Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: How to refer to the constant in a previously estimated regression?


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: Re: How to refer to the constant in a previously estimated regression?
Date   Wed, 1 Jul 2009 22:06:49 +0200

<>

***
sysuse auto, clear
reg pr we re tr
estimates save "modelA", replace
reg pr we re tr tu
estimates save "modelB", replace
clear*
sysuse auto, clear
est use "modelA"
predict newmodelA, xb
replace newmodelA=newmodelA-_b[_cons]
est use "modelB"
predict newmodelB, xb
replace newmodelB=newmodelB-_b[_cons]
***


HTH
Martin
_______________________
----- Original Message ----- From: "sdm1" <[email protected]>
To: <[email protected]>
Sent: Wednesday, July 01, 2009 7:29 PM
Subject: st: How to refer to the constant in a previously estimated regression?


I'm using Stata 10. I've previously estimated a couple of regression models
and have saved the model coefficients to a .ster file.  Now want to use
these model coefficients in conjunction with some new data to form predicted
values.

I recall the old estimates using:

estimates use "modelA"
estimates store modelA

estimates use "modelB"
estimates store modelB

Then I use:

estimates for modelA: predict newmodelA, xb
estimates for modelB: predict newmodelB, xb

Both regression models included a constant and so the new sets of
predictions (newmodelA and newmodelB) both incorporate their respective
constants. However, I'd like to subtract the regression constant from both
sets of predictions. In other words I'd like to:

gen prednoconsA=newmodelA - [constant from model A]
gen prednoconsB=newmodelB - [constant from model B]

How do I refer to [constant from model A] and [constant from model B] to do
this?

Thanks.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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