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
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: Useful labelling of dummy variables following logit
Date
Fri, 26 Aug 2011 09:20:30 +0100
Asterisks are for film or hotel reviews or the like!
The way to get different colours is to get separate variables. You use
-separate- to get two variables and then you superimpose two -twoway-
graphs.
This shows some technique.
set scheme s1color
sysuse auto, clear
gsort -rep78 mpg
gen order = _n
labmask order, values(make)
count if rep78 == 5
local N = r(N)
twoway bar mpg order if rep78 == 5, ///
horizontal yla(1/`N', noticks valuelabel ang(h)) barw(0.8) ytitle("")
separate mpg, by(foreign)
twoway bar mpg0 order if rep78 == 5, ///
horizontal yla(1/`N', noticks valuelabel ang(h)) barw(0.8) ///
|| bar mpg1 order if rep78 == 5, ///
horizontal barw(0.8) legend(order(1 "Domestic" 2 "Foreign")) ytitle("") ///
xtitle(`: var label mpg')
On Fri, Aug 26, 2011 at 8:59 AM, Tim Evans <[email protected]> wrote:
> Having given some more thought to only presenting significant predictors, is it possible to graph all of the predictors, but change the colour of the bars of the significant predictors in order to distinguish them from the others? Alternatively could I place an asterix at the end of the bar to show the significant ones?
>
> Best wishes
>
> Tim
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
> Sent: 25 August 2011 14:25
> To: [email protected]
> Subject: Re: st: Useful labelling of dummy variables following logit
>
> A very bad idea in my view. A model is not fairly reported if you
> don't pay attention to all its predictors. But you can always go
> -yla(1/`=_N')-.
>
> Nick
>
> On Thu, Aug 25, 2011 at 2:13 PM, Tim Evans <[email protected]> wrote:
>> Nick, Maarten
>>
>> I think I have what I want now and agree that the graphical presentation is nicer/easier to interpret. Thanks for your help.
>>
>> However, I think I have one final thing to achieve. I only want to plot the variables that have significant p values - this is fine as I can drop them at the end of the code:
>>
>> replace parm = "baseline odds" if parm == "_cons"
>> drop if p <=0.05
>> egen axis= axis(z), label(parm)
>>
>>
>> However I want to incorporate into the graph code the fact that the signifcant number of variables may change between each regression so the 'ylab(1/14, valuelabel ang(h) noticks' command may change so that I have 12 variables rather than 14 in another regression - but I'd like Stata to do this rather than me having to pick out the number after each regression as I have a number of regressions to do.
>>
>>
>> **BEGIN EXAMPLE****
>> twoway bar estimate axis, xscale(log) base(1) horizontal barw(.5) ///
>> xline(1) ylab(1/14, valuelabel ang(h) noticks) || ///
>> rcap min95 max95 axis, horizontal ///
>> legend(order(1 "point estimate" ///
>> 2 "95% conf. int.") pos(6)) ///
>> xtitle("odds ratio") ytitle("")
>> ***END EXAMPLE***
>>
>> Best wishes
>>
>> Tim
>>
>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]] On Behalf Of Maarten Buis
>> Sent: 25 August 2011 09:30
>> To: [email protected]
>> Subject: Re: st: Useful labelling of dummy variables following logit
>>
>> On Thu, Aug 25, 2011 at 10:08 AM, Tim Evans wrote:
>>> Thanks for the help again. I've tried your example below, but it fails on the following code:
>>>
>>> parmest, norestore eform
>>> Invalid estimates matrix: e(b)
>>> last estimates not found
>>> r(301);
>>
>> The example works on my computer, which makes it hard to diagnose the
>> problem. Did you run the entire example (including the -logit- model)?
>> Do you have the latest version of -parmest-? I got mine by typing -ssc
>> install parmest, replace-.
>
*
* 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/