Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Christopher Baum <kit.baum@bc.edu> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: How to retrieve coefficient of a model using "by company name:..." |
Date | Sun, 30 Oct 2011 07:25:52 -0400 |
<> On Oct 30, 2011, at 2:33 AM, Stephen wrote: > I have just run a regression "by company_name:", which gives me regression statistics for each company > in my dataset as shown below, for example: > > by company_name: reg return spci_rm > _________________________________________________________________ > - -> company_name = AGL RESOURCES INC > > Source | SS df MS Number of obs = 60 > - -------------+-------------------------------------- F( 1, 58) = 6.07 > Model | .013284831 1 .013284831 Prob > F = 0.0168 > Residual | .127033783 58 .002190238 R-squared = 0.0947 > - -------------+------------------------------------- Adj R-squared = 0.0791 > Total | .140318614 59 .002378282 Root MSE = .0468 > > - ---------------------------------------------------------------------------------------------- > return | Coef. Std. Err. t P>|t| [95% Conf. Interval] > - -------------+------------------------------------------------------------------------------- > spci_rm | .4204443 .1707167 2.46 0.017 .0787176 .7621709 > _cons | -.0011355 .0061018 -0.19 0.853 -.0133496 .0110786 > - ---------------------------------------------------------------------------------------------- > > _______________________________________________________________ > - -> company_name = ALLEGHENY ENERGY INC > > Source | SS df MS Number of obs = 60 > - -------------+-------------------------------------- F( 1, 58) = 8.18 > Model | .010267679 1 .010267679 Prob > F = 0.0059 > Residual | .072769554 58 .001254647 R-squared = 0.1237 > - -------------+------------------------------------- Adj R-squared = 0.1085 > Total | .083037232 59 .001407411 Root MSE = .03542 > > - --------------------------------------------------------------------------------------------- > > > Now, I want to make use of the estimated coefficient for each company on the only variable in the > above model, spci_rm, to run another regression. How can I get these coefficients automatically > transferred or summarized by company to be transferred to another dataset without manually > inputing the coefficients in the dataset for the second regression that I want to run. This is the purpose of the -statsby- command. See the example in its help file. Kit Kit Baum | Boston College Economics & DIW Berlin | http://ideas.repec.org/e/pba1.html An Introduction to Stata Programming | http://www.stata-press.com/books/isp.html An Introduction to Modern Econometrics Using Stata | http://www.stata-press.com/books/imeus.html * * 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/