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

RE: st: how to make xi dummies inherit labels


From   John Hendrickx <john_hendrickx@yahoo.com>
To   statalist@hsphsun2.harvard.edu
Subject   RE: st: how to make xi dummies inherit labels
Date   Thu, 3 Oct 2002 04:33:16 -0700 (PDT)

Hi Roger,

-desmat- should add a few seconds to your calculations but two
minutes is way too much. One explanation might be that a continuous
variable wasn't specified as such, then -desmat- will create dummies
for all 100+ categories and estimation will take a long time. Let me
know if -desmat- really slows things down that much on a large
dataset, maybe it would be worthwhile to create a lite version.

As for exponential coefficients, use the -exp- option, 

desmat: logistic y x, exp

will give the same results as

xi: logistic y i.x

-logistic- prints exponential coefficients but saves them as
loglinear values. 

Good luck,
John Hendrickx

--- Roger Harbord <Roger.Harbord@bristol.ac.uk> wrote:
> What I was really after in the end was similar to the output of
> e.g.
> . xi: logistic y i.x
> . reformat, eform
> 
> - but with the coefficients labelled using the value labels
> assigned to x.
> -desmat- does achieve this, but I had a couple of different
> problems when I 
> tried -desmat-:
> 
> 1) It takes over 2 minutes to run the first univariable logistic
> regression 
> with -desmat- on my data , when -xi- is seemingly instant.  May be 
> connected to the fact that my dataset has 1100 variables (and 2400 
> observations).  Much quicker subsequently though, even run on
> different 
> variables.
> 
> 2) I can't see how to get -desmat- to exponentiate the coefficients
> (to 
> give odds ratios with logistic regression) when used as a command
> prefix:
> 
> . desmat: logistic y i.x
> 
> gives the same output as:
> 
> . desmat: logit    y i.x
> 
>  - and there's no -eform- option as there is with -outreg- and
> -reformat-.
> 
> Also I think -reformat- or -outreg- give me more flexibility in
> deciding 
> what I want in the output, so I don't need to do so much work on
> the output 
> before I present it to my client, which is ultimately my aim.
> 
> In conclusion i'll probably use Nick's 'canned solution' for
> transferring 
> value labels to variable labels of dummies, in combination with
> -reformat- 
> or -outreg-.  But maybe it would be nice if there was an option for
> -xi- to 
> tell it to inherit the labels in this way.  Put that on the wish
> list for 
> Stata 8...
> 
> 
> Roger.
> ----------------------------------------------------
> Roger Harbord     mailto:roger.harbord@bristol.ac.uk
> Department of Social Medicine, University of Bristol
> 
> 
> 
> --On 03 October 2002 09:33 +0100 Nick Cox <n.j.cox@durham.ac.uk>
> wrote:
> 
> > John Hendrickx
> >
> >> -desmat- will do this. Try -ssc describe desmat-
> >
> > I tried -desmat- after my posting. I couldn't
> > see that it did quite this.
> >
> > Example:
> >
> >
>
----------------------------------------------------------------------
> > -------------------------------------
> >        log:  C:\Stata7\desmat.log
> >   log type:  text
> >  opened on:   3 Oct 2002, 09:30:21
> >
> > . u auto
> > (1978 Automobile Data)
> >
> > . desmat : regress mpg foreign
> >
>
----------------------------------------------------------------------
> > ---------
> >    regress
> >
>
----------------------------------------------------------------------
> > ---------
> > < snip >
> >
>
----------------------------------------------------------------------
> > ---------
> > nr Effect                                                    
> Coeff
> > s.e.
> >
>
----------------------------------------------------------------------
> > ---------
> >    foreign
> > 1    Foreign                                                 
> 4.946**
> > 1.362
> > 2  _cons                                                    
> 19.827**
> > 0.743
> >
>
----------------------------------------------------------------------
> > ---------
> > *  p < .05
> > ** p < .01
> >
> > . d _x_1
> >
> >               storage  display     value
> > variable name   type   format      label      variable label
> >
>
----------------------------------------------------------------------
> > ---------
> > _x_1            byte   %8.0g                  foreign==1
> >
> >
> > . tab foreign
> >
> >    Car type |      Freq.     Percent        Cum.
> > ------------+-----------------------------------
> >    Domestic |         52       70.27       70.27
> >     Foreign |         22       29.73      100.00
> > ------------+-----------------------------------
> >       Total |         74      100.00
> >
> >
> > That is, the variables created do not inherit value labels,
> > which I understood be what Roger wanted.
> >
> > Nick
> > n.j.cox@durham.ac.uk
> >
> > *
> > *   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/
> 
> 
> *
> *   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/


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
*
*   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