Statalist


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

Re: st: Adding variables not in the coefficients for outreg2 or estout


From   Ben Jann <ben.jann@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Adding variables not in the coefficients for outreg2 or estout
Date   Tue, 10 Feb 2009 15:39:30 +0100

In -estout- you can use the -order()- option to enforce a specific
order of coefficients. With the newest -estout- version, it is also
possible to specify coefficients in -order()- that are not part of the
table in which case extra table rows are inserted. Example:

. drop _all
. set obs 100
. drawnorm y var1 var2 var3 var4 var5 var6
. eststo Model1: reg y var2 var3 var6
. eststo Model2: reg y var1 var3 var5 var6
. estout Model1 Model2, drop(_cons) ///
>     order(var1 var2 var3 var4 var5 var6)

--------------------------------------
                   Model1       Model2
                        b            b
--------------------------------------
var1                          .1177138
var2             .0800025
var3             .0693237     .0537963
var4
var5                         -.0658128
var6              .007805     .0298289
--------------------------------------

To insert "Group1"-type rows you can also use -order()-, e.g.

. estout Model1 Model2, drop(_cons) ///
>     order(Group1 var1 var2 var3 Group2 var4 var5 var6)

--------------------------------------
                   Model1       Model2
                        b            b
--------------------------------------
Group1
var1                          .1177138
var2             .0800025
var3             .0693237     .0537963
Group2
var4
var5                         -.0658128
var6              .007805     .0298289
--------------------------------------

. estout Model1 Model2, drop(_cons) ///
>     order("Group 1" var1 var2 var3 "Group 2" var4 var5 var6)

--------------------------------------
                   Model1       Model2
                        b            b
--------------------------------------
Group 1
var1                          .1177138
var2             .0800025
var3             .0693237     .0537963
Group 2
var4
var5                         -.0658128
var6              .007805     .0298289
--------------------------------------

although a better approach, in my opinion, is to use the -refcat()-
option. Example:

. estout Model1 Model2, drop(_cons) ///
>     order(var1 var2 var3 var4 var5 var6) ///
>     refcat(var1 "Group 1" var4 "Group 2", nolabel)

--------------------------------------
                   Model1       Model2
                        b            b
--------------------------------------
Group 1
var1                          .1177138
var2             .0800025
var3             .0693237     .0537963
Group 2
var4
var5                         -.0658128
var6              .007805     .0298289
--------------------------------------

. forvalues i=1/6 {
  2.     label variable var`i' "- variable `i'"
  3. }

. estout Model1 Model2,  drop(_cons) label    ///
>     order(var1 var2 var3 var4 var5 var6)    ///
>     refcat(var1 "Group 1" var4 "Group 2", nolabel)

----------------------------------------------
                           Model1       Model2
                                b            b
----------------------------------------------
Group 1
- variable 1                          .1177138
- variable 2             .0800025
- variable 3             .0693237     .0537963
Group 2
- variable 4
- variable 5                         -.0658128
- variable 6              .007805     .0298289
----------------------------------------------

ben

On Tue, Feb 3, 2009 at 3:32 AM, A G <gueorguieva@hotmail.com> wrote:
>
> Colleagues,
> I am currently running several stepwise regressions with many explanatory variables.
>
> Stepwise drops different variables in each regression which causes for me a problem in presenting a neat table at the end with all the variables in the order that I want them. I would like to have all the variables in the table, in the order in which I have put them in the regression.
>
> The ideal table would look like this (hope the formating will work)
>                           Model1   Model2
> Group of variables 1
>   Var1                                 x
>   Var2                     x
>   Var3                     x           x
> Group2
>   Var4
>   Var5                                 x
>   Var6                      x
>
>
> For outreg2, used keep(var1 ...var6) to no avail (meaning only the variables that were estimated are included in the table).
> For estout, I get "coefficient var1 not found".
>
> I am currently tricking outreg2 into keeping all the variables by running a regression first in the order that I want, compiling all regressions and with the intention of deleting the first column at the end. No idea how to add "Group1"-type rows (addnote does not do that in outreg2).
>
> Any help would be appreciated.
> Apologies if this has been discussed. Searched group|order and outreg2|estout and was not able to find anything. Using stata 10.1 on windows xp platform.
>
> Thank you in advance.
> Sincerely,
> Anna
> _________________________________________________________________
> Windows Live™ Hotmail(R)…more than just e-mail.
> http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t2_hm_justgotbetter_howitworks_012009
> *
> *   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/



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