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

From |
"Pablo Gonzalez" <[email protected]> |

To |
<[email protected]> |

Subject |
st: Question about regress and multiple datasets |

Date |
Thu, 15 Sep 2005 17:54:24 +0100 |

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/

**Follow-Ups**:**st: Re: Question about regress and multiple datasets***From:*"Michael Blasnik" <[email protected]>

**st: Re: Question about regress and multiple datasets***From:*"R.E. De Hoyos" <[email protected]>

- Prev by Date:
**Re: st: textbox_options in Stata9 graphics manual** - Next by Date:
**RE: st: RE: Joint F test in the panel data when cluster option used** - Previous by thread:
**st: Combined Horizontal Box Blots do not line up** - Next by thread:
**st: Re: Question about regress and multiple datasets** - Index(es):

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