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 on April 23, 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 16:56:20 +0100

If a variable has no variable label, nothing will be shown. So, safer code is

if "`l`v''" != "" replace parm = "`l`v''" if parm == "`v'"

On Wed, Aug 24, 2011 at 4:54 PM, Nick Cox <njcoxstata@gmail.com> wrote:
> 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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index