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

Re: st: Re: Regression results formatted for publication


From   Roger Newson <roger.newson@kcl.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: Regression results formatted for publication
Date   Wed, 21 May 2003 21:49:25 +0100

Sorry Statalisters. My first line of Stata code should of course read

gene str8 pstar=string(p,"%8.4f")

(This is what happens when you put code on Statalist without first testing it. The rest seems to be OK.)

Best wishes

Roger

At 20:55 21/05/03 +0100, I wrote:

At 11:28 21/05/03 -0400, Danielle Ferry wrote:
Hi StataListers,
I've been using outreg to make tables containing selected regression results
as well as lincom coefficients & SEs. One problem with this is that I still
have to go back and manually put asterisks on SEs from lincom tests to
indicate significance. Since I've switched to Stata 8, another bigger
problem emerged wherein the lincom SE's get mixed up in the output and I
also have to go back and then manually correct them after reading the "out"
file into Excel. Then, if I rerun and refresh data in Excel I have to once
again make corrections & add significance asterisks. Can anyone suggest an
efficient way to get my regression results into a publication-happy format
where I can include lincom and/or F-test results and have multiple columns
for varying models? Any help would be much appreciated, as this is beginning
to drive me insane.
As it happens, this problem used to drive me insane, too. Nowadays, however, I have a whole suite of programs to get Stata estimation results into publication-happy format, and they are downloadable either from SSC or from my website, which can be accessed by typing (in Stata)

net from http://www.kcl-phs.org.uk/rogernewson/

The -parmest- package saves the results of estimation commands in a data set with one observation per estimated parameter and data on estimates, standard errors, confidence limits, P-values, and other parameter attributes specified by the user. The -dsconcat- package concatenates multiple data sets, or subsets of them, and is useful if you want to collect the interesting parameters from multiple regression models, discarding the uninteresting parameters. The -lincomest- package copies -lincom- parameters into estimation results, which can then be written to data sets by the -parmest- package and combined with the other parameters using -dsconcat-. The -listtex- package outputs a data set of regression results, either to a file or to the Command window, in a form that can easily be cut and pasted into Microsoft Word documents (or even TeX, LaTeX or HTML documents). Other members of the team are -eclplot- (a Stata 8 package for producing publication-quality confidence interval plots) and the data handling tools -sencode-, -bygap-, -descsave- and -factext-.

Danielle mentions adding stars to P-values, which is a useful thing to want to do, assuming you are submitting to a journal that likes stars (which many statistical referees nowadays don't). Once you have your P-values in a variable -p- in a -parmest- output data set, you can proceed as follows:

gene str8 pstar=string(p,%8.4f)
replace pstar=pstar+"*" if p<=0.05
replace pstar=pstar+"*" if p<=0.01
replace pstar=pstar+"*" if p<=0.001

and you will then have a string variable -pstar- containing a formatted version of the P-value with the appropriate number of stars (if you think stars are appropriate). The variable -pstar- can then be output, with whatever estimates and confidence limits Danielle wants to add, using -listtex-, or possibly the official Stata command -outsheet- if Danielle wants to input the output to Excel.

Another useful command might be -tostring-, also downloadable from SSC, and written by Nick Cox and Jeremy Wernow. This converts numeric variables into string variables with the same names and variable labels. For instance, if you have 3 numeric variables -estimate-, -min95- and -max95-, containing estimates, lower confidence limits and upper confidence limits, respectively, then you might type

tostring estimate min95 max95,format(%8.2f)
replace min95="("+min95+","
replace max95=max95+")"

and there will then be 3 string variables -estimate-, -min95- and -max95- where the 3 numeric variables used to be, with the lower and upper confidence limits formatted as most journals like them nowadays. These variables, like the -pstar- mentioned earlier, can then be output using -listtex- and/or -outsheet-.

I plan to write a Stata Journal article in the near future about all these packages, and how they can work together to produce publication-happy output.. However, they can all be downloaded from SSC (see -help ssc- for details).

I hope this helps.

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

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/

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

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