[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Newson, Roger B" <r.newson@imperial.ac.uk> |

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

Subject |
RE: st: RE: latex table with estimation results reported in rows and coefficient estimates listed in columns |

Date |
Wed, 26 Aug 2009 20:13:43 +0100 |

I think you need to use the -el()- function in your -statsby- command to extract multiple items from the same matrix to each observation in the output dataset. The expression el("e)b)",1,1) returns the first regression coefficient in the model. And the function el("e(b)",1,2) returns the second regresion coefficient in the model. So your -statsby- code might look something like tempfile tf1 statsby N=(e(N)) r2=(e(r2)) beta1=(el("e(b)",1,1)) beta2=(el("e(b)",1,2)) , saving(`"`tf1'"', replace) : regress mpg price weight and this should create a file with 1 observation, and 4 variables -N-, -r2-, -beta1- and -beta2-, containing the sample size, the R-squared, the first regression coefficient, and the second regression coefficient, respectively. (If you were using -parmby- instead of -statsby-, then you would have to use -reshape wide- afterwards to get observations with 2 regression coefficients each.) I hope this helps. Best wishes Roger Roger B Newson BSc MSc DPhil Lecturer in Medical Statistics Respiratory Epidemiology and Public Health Group National Heart and Lung Institute Imperial College London Royal Brompton Campus Room 33, Emmanuel Kaye Building 1B Manresa Road London SW3 6LR UNITED KINGDOM Tel: +44 (0)20 7352 8121 ext 3381 Fax: +44 (0)20 7351 8322 Email: r.newson@imperial.ac.uk Web page: http://www.imperial.ac.uk/nhli/r.newson/ Departmental Web page: http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/ Opinions expressed are those of the author, not of the institution. -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of richard boylan Sent: 26 August 2009 19:40 To: statalist@hsphsun2.harvard.edu Subject: Re: st: RE: latex table with estimation results reported in rows and coefficient estimates listed in columns The problem with doing it this way is that the standard error for each coefficient has to end up in the same line. I should have specified that I would want the standard error to be below and in parenthesis below each coefficient. I tried to figure out if there was a way to do that with listtex but could not figure it out a way. On Wed, Aug 26, 2009 at 12:25 PM, Newson, Roger B<r.newson@imperial.ac.uk> wrote: > This looks like possibly a job that should be done in 3 steps. First, use -statsby- in a loop to create an output dataset for each regression, with 1 observation, and variables containing the 2 coefficients, sample size, and R-squared. Second, use -append- in Stata 11, or the SSC package -dsconcat- in Stata 10 or lower, to concatenate these datasets into the memory, replacing the original dataset. Third, use -listtex-, downloadable from SSC, to produce the output LaTeX table, with header and/or footer rows, in a file, or in the Results window, to be cut and pasted into your LaTeX document. > > The -listtex- and -dsconcat- packages can be downloaded from SSC, using the -ssc- command in Stata. Both are cueenntly in Stata Version 10. Earlier versions can still be downloaded from my website by typing > > net from http://www.imperial.ac.uk/nhli/r.newson/ > > and selecting the Stata version required. > > I hope this helps. > > Best wishes > > Roger > > > Roger B Newson BSc MSc DPhil > Lecturer in Medical Statistics > Respiratory Epidemiology and Public Health Group > National Heart and Lung Institute > Imperial College London > Royal Brompton Campus > Room 33, Emmanuel Kaye Building > 1B Manresa Road > London SW3 6LR > UNITED KINGDOM > Tel: +44 (0)20 7352 8121 ext 3381 > Fax: +44 (0)20 7351 8322 > Email: r.newson@imperial.ac.uk > Web page: http://www.imperial.ac.uk/nhli/r.newson/ > Departmental Web page: > http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/ > > Opinions expressed are those of the author, not of the institution. > > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of richard boylan > Sent: 26 August 2009 17:37 > To: statalist@hsphsun2.harvard.edu > Subject: st: latex table with estimation results reported in rows and coefficient estimates listed in columns > > I was looking for a package to make latex table from regession > estimates except that I need the estimation results reported in rows > and coefficient estimates listed in columns. > > The only package that I could find that does that is est2tex, but when > one produces estimates in this horizontal format it suppresses the > r-squared and sample size. > > Does anyone know of any packages that allow this? I.e., I need > > > Coefficient 1 Coefficient 2 Sample > size R-squared > Reg 1 > > Reg 2 > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: RE: latex table with estimation results reported in rows and coefficient estimates listed in columns***From:*richard boylan <richardtb25@gmail.com>

**References**:**st: latex table with estimation results reported in rows and coefficient estimates listed in columns***From:*richard boylan <richardtb25@gmail.com>

**st: RE: latex table with estimation results reported in rows and coefficient estimates listed in columns***From:*"Newson, Roger B" <r.newson@imperial.ac.uk>

**Re: st: RE: latex table with estimation results reported in rows and coefficient estimates listed in columns***From:*richard boylan <richardtb25@gmail.com>

- Prev by Date:
**RE: st: latex table with estimation results reported in rows and coefficient estimates listed in columns** - Next by Date:
**Re: st: RE: latex table with estimation results reported in rows and coefficient estimates listed in columns** - Previous by thread:
- Next by thread:
- Index(es):

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