Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Compare regression outputs of different models
From
Maarten Buis <[email protected]>
To
[email protected]
Subject
Re: st: Compare regression outputs of different models
Date
Thu, 11 Aug 2011 09:47:44 +0200
On Thu, Aug 11, 2011 at 9:15 AM, iank131 wrote:
> 1. I am running a robust regression (rreg) and have several but
> slightly different models to run on the same data set. I want to
> compare the different models by lining them up vertically side by
> side <snip> I would like to find a quick way to save these
> outputs and then generate a table in Stata in which I can see the see
> the coefficients of each independent variable, their corresponding
> standard errors below (not beside) the coefficient, and a star or
> stars next to the coefficient if its significance is below say 10%,
> 5%, 1%, etc.
>
> 2. How do you get stata to automatically calculate the r-squared and
> adjusted r-squared after running rreg?
There exist within Stata several user written solutions for this type
of problem. I like -estout- written by Ben Jann, in particular because
of the very extensive set of examples available from
<http://repec.org/bocode/e/estout/>. You can get that program by
typing in Stata -ssc install estout-. The basic trick is to prefix
your estimation commands with -eststo :- to store these models, and
than display them using -esttab-. The R-squared and adjusted R-squared
are not displayed in the output but they returned by -rreg-, in e(r2)
and e(r2_a), so programs like -estout- can access and display them.
*--------------------- begin example -----------------------
eststo clear
sysuse auto, clear
* Model 1
eststo: rreg price mpg weight
* Model 2
eststo: rreg price mpg weight length
* Model 3
eststo: rreg price mpg weight length foreign
esttab
// adding R^2 and adj. R^2
esttab , r2 ar2
// you can also include this table in your article/paper
// e.g. -rtf- function creates an .rtf file which can be
// read in all/most versions of M$ Word.
esttab using "c:/temp/foo", r2 ar2 rtf replace
*---------------------- end example -------------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* 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/