Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Export a table comparing results from regressions with differing variables


From   John Luke Gallup <jlgallup@pdx.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Export a table comparing results from regressions with differing variables
Date   Wed, 5 Dec 2012 12:34:47 -0800

Ly,

I don't think you can use -outreg2- to do what you want and I am not familiar enough with -xml_tab- to know if that would work.  However, you can do this with the new version of -outreg- because it can combine tables side-by-side (with the -merge- option) and above and below (with the -append- option).

The following code creates a table like the one you are looking for:

sysuse auto, clear
gen mpgFOR = mpg*foreign
gen mpgDOM = mpg*!foreign
gen wgtFOR = weight*foreign
gen wgtDOM = weight*!foreign
gen lenFOR = length*foreign
gen lenDOM = length*!foreign

local crlist "DOM FOR"
outreg, clear
foreach cr of local crlist {
	reg mpg`cr' wgt`cr'
	outreg, append noautosumm nocons rtitle(`cr')
}
outreg, clear(Col2)
foreach cr of local crlist {
	reg mpg`cr' len`cr'
	outreg, append(Col2) noautosumm nocons rtitle(`cr')
}
outreg using bangnuoc, replay merge(Col2) ctitle("", Weight, Length)
 
The table looks like this:

                                                   -----------------------------
                                                           Weight     Length   
                                                   -----------------------------
                                                    DOM     0.004      0.091   
                                                          (9.14)**   (13.12)** 
                                                    FOR     0.010      0.143   
                                                          (16.54)**  (21.91)** 
                                                   -----------------------------
                                                        * p<0.05; ** p<0.01

John


On Dec 4, 2012, at 8:38 AM, Ly Tran <lyhuyen@brandeis.edu> wrote:

> I am sorry, I hit the send button before finishing the email.
> 
> Hi everyone,
> I am trying to compare results from multiple regressions that do not
> share any variables.
> For example, there are 6 regressions
> local crlist "USD GBP EUR"
> foreach cr of local crlist {
> reg dep`cr' indep1`cr'
> reg dep`cr' indep2`cr'
> }
> If I use xml_tab or outreg2, the coefficients will be placed
> diagonally, which is very difficult to compare.
> The table will be like this:
>                         depUSD    depUSD    depGBP    depGBP
> depEUR     depEUR
> indep1USD          coef1
> indep2USD                             coef2
> indep1GBP                                             coef3
> indep2GBP                                                               coef4
> indep1EUR
>                     coef5
> indep2EUR
>                                       coef6
> 
> And the table I am trying to achieve should look like this
>                 indep1           indep2
> USD           coef1           coef2
> GBP           coef3           coef4
> EUR           coef5           coef6
> 
> My thinking is, xml_tab should be able to help with this, but I have
> tried different specifications to no avail.
> Any help will be much appreciated.
> 
> Thank you so much.
> 
> 
> --
> Ly Tran
> 
> --
> Ly Tran
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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