Bookmark and Share

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: Factor variables and outreg/outreg2


From   Mirko <[email protected]>
To   [email protected]
Subject   Re: st: Factor variables and outreg/outreg2
Date   Sun, 4 Apr 2010 16:17:14 +0100

Dear all,
My aim is to obtain a table only for some coefficients (the
interaction terms or factor variables) using -outreg2-, but -outreg2-
does not work with factor variables. I found a thread where the same
problem was discussed on 28 January 2010, but there is no solution
provided.
Any suggestion/fix that could be implemented? Please find an example below.
Thanks
Mirko

*-------------- begin example ---------------------
sysuse auto, clear
tempname myfile
regress mpg i.foreign##c.weight i.rep78 headroom
outreg2 i.foreign##c.weight headroom using `myfile', see
*---------------- end example ---------------------


. sysuse auto, clear
(1978 Automobile Data)

.
. tempname myfile

.
. regress mpg i.foreign##c.weight i.rep78 headroom

      Source |       SS       df       MS              Number of obs =      69
-------------+------------------------------           F(  8,    60) =   22.97
       Model |  1764.16138     8  220.520173           Prob > F      =  0.0000
    Residual |  576.041518    60  9.60069196           R-squared     =  0.7538
-------------+------------------------------           Adj R-squared =  0.7210
       Total |   2340.2029    68  34.4147485           Root MSE      =  3.0985

------------------------------------------------------------------------------
         mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   1.foreign |   16.19956   5.203251     3.11   0.003     5.791513    26.60761
      weight |   -.005067   .0007408    -6.84   0.000    -.0065488   -.0035853
             |
     foreign#|
    c.weight |
          1  |  -.0083102   .0021961    -3.78   0.000    -.0127031   -.0039173
             |
       rep78 |
          2  |   .2006326   2.583702     0.08   0.938     -4.96754    5.368805
          3  |    .180679   2.381479     0.08   0.940    -4.582988    4.944345
          4  |   1.169124   2.487237     0.47   0.640    -3.806092    6.144339
          5  |   5.898554   2.663781     2.21   0.031     .5701987    11.22691
             |
    headroom |  -.4860751   .5404865    -0.90   0.372    -1.567209    .5950589
       _cons |   37.55845   3.039136    12.36   0.000     31.47927    43.63762
------------------------------------------------------------------------------

.
. outreg2 i.foreign##c.weight headroom using `myfile', see
factor variables not allowed
r(101);


On 28 January 2010 19:27, Roy Wada <[email protected]> wrote:
> It's the factor variables in the varlist that was causing the problem.
> I sent a fix to Josh.
>
> Roy
>
>
> On Thu, Jan 28, 2010 at 10:51 AM, Joshua Gottlieb
> <[email protected]> wrote:
>> Sorry; I was unclear about my goal.  I only want to output some of the
>> variables, since I have a large number of other covariates that I
>> don't want to report.  For example, consider this modification of
>> Maarten's example, where I want to prevent outreg2 from exporting
>> coefficients on all of the rep78 fixed effects:
>>
>> *-------------- begin example ---------------------
>> sysuse auto, clear
>> tempname myfile
>> regress mpg i.foreign##c.weight i.rep78 headroom
>> outreg2 i.foreign##c.weight headroom using `myfile', see
>> *---------------- end example ---------------------
>>
>> The -outreg2- command here will generate an error, whereas the
>> following command will work fine:
>> outreg2 headroom using `myfile', see
>>
>> Thank you very much.
>>
>> Josh
>>
>>
>>
>> On Wed, Jan 27, 2010 at 12:46 PM, Roy Wada <[email protected]> wrote:
>>>> this is in Stata 11.)  Do you know if there's any workaround so that I
>>>> can choose specific factor variables and interactions to include in my
>>>> outreg2 output?
>>>
>>> It's not clear what you typed into Stata. If you can replicate the
>>> error using -sysuse auto- and send us what you typed, then that would
>>> be helpful.
>>>
>>> Roy
>>>
>>> *
>>> *   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index