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

st: RE: HELP DESPERATE PANEL DATA FOREACH


From   Roger Newson <roger.newson@kcl.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: RE: HELP DESPERATE PANEL DATA FOREACH
Date   Sun, 22 Jun 2003 16:25:26 +0100

At 15:59 22/06/03 +0100, Nick Cox wrote (in reply to Naddia Simoes)::
naddiasimoes

> I'm regressing productivity on time for a panel of 2000 firms for
> five years. can someone tell me how can I create a macro and run a
> program with foreach, regressing this for each  firm and store the
> coefficients in a matrix?

With the obvious reservations about fitting
a regression to subsets of five data points,
I recommend -statsby- for this problem.
That is, there is a wired-in command that
makes it unnecessary to write your own here.
If you really want a matrix, not variables,
to store results then use -mkmat-.
Another possibility would be to use the -parmest- package, downloadable from SSC. (Type -ssc desc parmest- to find out more.) -parmby- is similar to -statsby-, but it creates an output data set with 1 observation per parameter per by-group, instead of 1 observation per by-group, and data on estimates, confidence limits, P-values and other parameter attributes as specified by the user.

Roger


--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
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://www.kcl-phs.org.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