Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: extracting coefficients from a linear regression


From   "Philippe Glaziou" <[email protected]>
To   [email protected]
Subject   Re: st: extracting coefficients from a linear regression
Date   Thu, 09 Jun 2005 18:00:00 +0800

On Thu, 09 Jun 2005 17:39:45 +0800, David Fisher <[email protected]> wrote:


Is there a command in Stata that will store the coefficients (a and b) from a linear regression in new, separate variables? I've looked at "predict" and similar, but I can only find how to extract residuals and fitted values.

Would the following do the job?

. sysuse auto
(1978 Automobile Data)

. regress mpg we

[output cut]

. local b = _b[_cons]

. local a = _b[weight]

. di `a'
-.00600869

. di `b'
39.440284



--
Philippe
*
*   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/



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