Statalist


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

st: AW: Regression by SIC and predicting different model


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: Regression by SIC and predicting different model
Date   Tue, 20 Oct 2009 09:15:34 +0200

<> 

So you would end up with 10 different z1-z10?


*************
clear*
set obs 10

gen byte industry=_n

expand 100

gen x1=rnormal()
gen x2=rnormal()
gen x3=rnormal()
gen x4=rnormal()

gen y=1+x1-2*x2+rnormal() 

forv i=1/10{
	reg y x1 x2 if industry==`i'
	gen z`i'=_b[_cons]+_b[x1]*x3+_b[x2]*x4
}
*************



HTH
Martin

-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Ferdinand
Siagian
Gesendet: Dienstag, 20. Oktober 2009 06:30
An: [email protected]
Betreff: st: Regression by SIC and predicting different model

Hi Statalist,

I try to run a regression for 10 different industries and use the
coefficients to predict a different model.

For example:

I regress the following regression for different industries:

Y = a + b X1 + c X2 + error

So, I use the following command

By industries: regress Y X1 X2;

I would like to use a-hat, b-hat, and c-hat to predict:

Z = a-hat + b-hat X3 + c-hat X4.

I tried "predict" but it did not work. I also tried using _b[var] but it did
not work.





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