[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"R.E. De Hoyos" <redeho@hotmail.com> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: Re: Question about regress and multiple datasets |

Date |
Thu, 15 Sep 2005 18:07:52 +0100 |

Pablo,

You can use -estout- to get the estimated coefficients and statistics deriving from several models into a single table. Alternatively you can use matrices , e.g. after your estimation type

mat B = e(b)

And you will put all the estimated coefficients into matrix (vector) B.

Type -ereturn list- after the estimation to find out the local macro defining the statistics you are looking for.

Rafa

________________________

R.E. De Hoyos

Faculty of Economics

University of Cambridge

CB3 9DE, UK

www.econ.cam.ac.uk/phd/red29/

----- Original Message ----- From: "Pablo Gonzalez" <ssrnmail@gmail.com>

To: <statalist@hsphsun2.harvard.edu>

Sent: Thursday, September 15, 2005 5:54 PM

Subject: st: Question about regress and multiple datasets

Hi everyone,

I'm having a problem with the regress function (it's not about the command

itself but with its use)and I would like to know if anyone could help

me...Basically, I have two problems that are interconnected:

1. Is it possible to retrieve the value of the coefficients directly? For

example, using the auto data example from stata:

. regress price mpg weight

Source | SS df MS Number of obs =

74

-------------+------------------------------ F( 2, 71) =

14.74

Model | 186321280 2 93160639.9 Prob > F =

0.0000

Residual | 448744116 71 6320339.67 R-squared =

0.2934

-------------+------------------------------ Adj R-squared =

0.2735

Total | 635065396 73 8699525.97 Root MSE =

2514

----------------------------------------------------------------------------

--

price | Coef. Std. Err. t P>|t| [95% Conf.

Interval]

-------------+--------------------------------------------------------------

--

mpg | -49.51222 86.15604 -0.57 0.567 -221.3025

122.278

weight | 1.746559 .6413538 2.72 0.008 .467736

3.025382

_cons | 1946.069 3597.05 0.54 0.590 -5226.245

9118.382

----------------------------------------------------------------------------

--

Does anyone know a command to retriece the coefficients from the regression,

ie, the coefficient associated with mpg, weight and const? Is it possible to

retrieve the cofficients from the t-stats, R^2, etc?

2. Imagine that we have the following data set (the number of observations

for each company is actually larger than the one showed...):

Company Y X1 X2

1 y_1 x1_1 x2_1

1 y_2 x1_2 x2_2

1 y_3 x1_3 x2_3

(...)

2 y_4 x1_4 x2_4

2 y_5 x1_5 x2_5

2 y_6 x1_6 x2_6

(...)

n y_n x1_n x2_n

n y_n1 x1_n1 x2_n1

n y_n2 x1_n2 x2_n2

(...)

I need to run a regression of Y=b0+b1*X1+b2*X2 for each company in the

dataset and then retrieve the coefficients for each regression obtained (and

t-stats and R^2) for each company and put it in another dataset/table. I've

tried to use a do file with a loop function, but I'm not able to get the

stuff working (because of the problem in 1. and because STATA doesn't seem

to be able to work with several datasets/files, or I haven't been able to

find this possibility).

Thanks for any help!

Pablo

*

* For searches and help try:

* http://www.stata.com/support/faqs/res/findit.html

* http://www.stata.com/support/statalist/faq

* http://www.ats.ucla.edu/stat/stata/

* * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: Question about regress and multiple datasets***From:*"Pablo Gonzalez" <ssrnmail@gmail.com>

- Prev by Date:
**st: Generating outcome variable for a Nested Logit Model** - Next by Date:
**st: How to specify Iterate equations** - Previous by thread:
**st: Question about regress and multiple datasets** - Next by thread:
**st: Re: Question about regress and multiple datasets** - Index(es):

© Copyright 1996–2014 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |