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


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Useful labelling of dummy variables following logit
Date   Wed, 24 Aug 2011 17:01:18 +0100

See my earlier post. For your last question, change the argument of
-egen, axis()-.

Nick

On Wed, Aug 24, 2011 at 4:57 PM, Tim Evans <Tim.Evans@wmciu.nhs.uk> wrote:
> 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: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
> Sent: 24 August 2011 16:54
> To: statalist@hsphsun2.harvard.edu
> 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 <Tim.Evans@wmciu.nhs.uk> 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: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
>> Sent: 24 August 2011 14:31
>> To: statalist@hsphsun2.harvard.edu
>> 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 <maartenlbuis@gmail.com> wrote:
>>> On Wed, Aug 24, 2011 at 2:56 PM, Tim Evans <Tim.Evans@wmciu.nhs.uk> 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/
>

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index