Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: How to retrieve coefficient of a model using "by company name:..."

 From Robson Glasscock To statalist@hsphsun2.harvard.edu Subject Re: st: How to retrieve coefficient of a model using "by company name:..." Date Sat, 29 Oct 2011 18:27:46 -0400

```Hi Stephen,
Take a look at -help ereturn- and -help postest-
Regression coefficients are saved in the e(b) matrix subsequent to
estimation. One of Stata's loop commands (-foreach- etc.) may be used
to automate the process.

best,
Robson Glasscock

On Sat, Oct 29, 2011 at 4:29 PM, Owusu-Ansah, Stephen <sowus2@uis.edu> 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.
>
> I look forward to hearing from somebody soon. Thanks.
>
> Regards,
>
> Stephen
>
> Stephen Owusu-Ansah, PhD, CIA, CBM
> Associate Professor of Accountancy
> Associate Editor, Journal of Accounting in Emerging Economies (JAEE)
> Associate Editor, Research in Accounting in Emerging Economies (RAEE)
> Department of Accountancy, UHB 4077
> College of Business and Management
> University of Illinois Springfield
> One University Plaza, MS UHB 4093
> Springfield, IL 62703-5407
> U.S.A.
>
> Tel: +1-217-206-8254
> Fax: +1-217-206-7543
> E-Mail: sowus2@uis.edu (Official)
>            stoansah@yahoo.com (Private)
> *
> *   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/
```