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: Useful labelling of dummy variables following logit


From   Tim Evans <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   RE: st: Useful labelling of dummy variables following logit
Date   Wed, 24 Aug 2011 16:57:23 +0100

Nick,

This is my code for my example:


xi: logit Early1 /*i.INVS2*/ i.eth2 age i.invsurg i.region i.dep if dep!=9 & sex==2 & ICD10=="C50", or

local i = 0
foreach v in Early1 eth2 age invsurg region dep {
	local l`v' : variable label `v'
}

parmest, norestore eform
foreach v in Early1 eth2 age invsurg region dep {
	replace parm = "`l`v''" if parm == "`v'"
}

replace parm = "(intercept)" if parm == "_cons"

**egen axis= axis(estimate), label(parm)
egen axis2 = axis(
twoway bar  estimate axis, base(1) horizontal barw(.5) ///
            xline(1) ylab(, valuelabel ang(h) noticks) ||             ///
       rcap min95 max95 axis, horizontal               ///
            legend(order(1 "point estimate"            ///
                         2 "95% conf. int.") pos(6))   ///
            xtitle("odds ratio") ytitle("")


I've seen it ranks them in order of estimate, I'm assuming I could do this based on the size of the z value also?

Best wishes

Tim


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
Sent: 24 August 2011 16:54
To: [email protected]
Subject: Re: st: Useful labelling of dummy variables following logit

Are you talking about this code or your equivalent on your problem?

If the latter, I need to see the code to comment helpfully.

Nick

On Wed, Aug 24, 2011 at 4:41 PM, Tim Evans <[email protected]> wrote:
> Nick,
>
> Thanks for this, it nearly works for me - I can graph it, but I don't get all of the variable values from the 'axis' column to appear - I only have random ones. Do you know why it does not display all of the variables names (but does display the estimate value)
>
> Tim
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
> Sent: 24 August 2011 14:31
> To: [email protected]
> Subject: Re: st: Useful labelling of dummy variables following logit
>
> Maarten's example doesn't show variable labels. Here is one way to do
> it. I may well be overlooking an option in -parmest-.
>
> Nick
>
> sysuse nlsw88, clear
> logit union married never_married collgrad south
>
> local i = 0
> foreach v in married never_married collgrad south {
>        local l`v' : variable label `v'
> }
>
> parmest, norestore eform
> foreach v in married never_married collgrad south {
>        replace parm = "`l`v''" if parm == "`v'"
> }
>
> replace parm = "(intercept)" if parm == "_cons"
>
> egen axis= axis(estimate), label(parm)
>
> twoway bar  estimate axis, base(1) horizontal barw(.5) ///
>            xline(1) ylab(, valuelabel ang(h) noticks) ||             ///
>       rcap min95 max95 axis, horizontal               ///
>            legend(order(1 "point estimate"            ///
>                         2 "95% conf. int.") pos(6))   ///
>            xtitle("odds ratio") ytitle("")
>
>
> On Wed, Aug 24, 2011 at 2:03 PM, Maarten Buis <[email protected]> wrote:
>> On Wed, Aug 24, 2011 at 2:56 PM, Tim Evans <[email protected]> wrote:
>>> Nick, in your last post, are you suggesting an alternative way of presenting things as I'm not sure I follow what you mean by:
>>>
>>> ' I'd much prefer to work at a graphical display of odds
>>> ratios and confidence limits with variable labels as horizontal text'
>>
>> See, e.g. <http://www.stata.com/statalist/archive/2010-09/msg00525.html>

*
*   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/

_DISCLAIMER:
This email and any attachments hereto contains proprietary information, some or all of which may be confidential or legally privileged. It is for the exclusive use of the intended recipient(s) only. If an addressing or transmission error has misdirected this e-mail and you are not the intended recipient(s), please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail or any attachments, as this may be unlawful.


*
*   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