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   Roger Harbord <[email protected]>
To   [email protected]
Subject   RE: st: how to make xi dummies inherit labels
Date   Thu, 03 Oct 2002 13:39:27 +0100

Hi John,

I've just installed the latest version of desmat available on SSC - Distribution-Date: 20011111. (I had the STB-61: dm73.3 version before.)However an -exp- option still doesn't exist:

. desmat: logistic siweekT2 age10yy2, exp
exp invalid
r(198);

. which desmat
c:\ado\stbplus\d\desmat.ado
*! version 3.0, 30Mar2001, [email protected]

And I'm not including any continuous covariates - only a single categorical one with 6 categories at present. -desmat- takes around 2 minutes even if I give an outcome variable that doesn't exist so that all it gives is an error message to that effect. (If given a non-existent covariate it complains straight away though.)

I suppose I could drop all those variables corresponding to questions that we're not using (data is results of a survey with a *long* questionnaire) but that would be some extra work to create and maintain a 'keep list' of variables I'm actually interested in.

Roger.


--On 03 October 2002 04:33 -0700 John Hendrickx <[email protected]> wrote:


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 <[email protected]> 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:[email protected]
Department of Social Medicine, University of Bristol



--On 03 October 2002 09:33 +0100 Nick Cox <[email protected]>
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
> [email protected]
>
> *
> *   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/

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index