Statalist


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

Re: st: AW: Regression by SIC and predicting different model


From   Ferdinand Siagian <fsiagian@maine.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: AW: Regression by SIC and predicting different model
Date   Tue, 20 Oct 2009 12:22:28 -0400

Thank you very much Martin.

I will try it.

Best regards,
Ferdinand


On 10/20/09 3:15 AM, "Martin Weiss" <martin.weiss1@gmx.de> wrote:

> 
> <> 
> 
> 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: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Ferdinand
> Siagian
> Gesendet: Dienstag, 20. Oktober 2009 06:30
> An: statalist@hsphsun2.harvard.edu
> 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/



*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index