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   Roger Newson <roger.newson@kcl.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: extracting coefficients from a linear regression
Date   Thu, 09 Jun 2005 18:25:31 +0100

Another possibility is to use the -parmest- package, downloadable from SSC. The -parmest- package produces an output dataset (or resultsset) with 1 observation per parameter (or 1 observation per parameter per by-group using the -parmby- program) and data on parameter names, estimates, confidence limits, P-values and other parameter attributes. This resultsset can be saved to disk, written to memory (overwriting the original data), or simply listed to the Stata log. The on-line help contains references to 2 downloadable papers on the use of -parmest- with other packages to produce plots and tables of estimates and confidence limits..

I hope this helps.

Best wishes

Roger


At 11:00 09/06/2005, Antione wrote:

le 09/06/2005 11:39, David Fisher a ecrit :
Hi!
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.
Thanks!
David Fisher


Stata stores estimated coefficients in a vector named e(b)
you can then use -svmat- to store its elements as new variables :

. reg pric mpg weight
. mat beta=e(b)
. svmat double beta, names(matcol)

will store estimated coefficients as new (double precision) variables named after the X variables.

best,
Antoine

--
Ce message a été vérifié par MailScanner
pour des virus ou des polluriels et rien de
suspect n'a été trouvé.

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

--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
Division of Asthma, Allergy and Lung Biology
King's College London

5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
  or 020 7848 6605 International +44 20 7848 6605
Email: roger.newson@kcl.ac.uk
Website: http://phs.kcl.ac.uk/rogernewson/

Opinions expressed are those of the author, not the institution.


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index