Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: graph hbox [with a discursus on intuition]


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: graph hbox [with a discursus on intuition]
Date   Fri, 12 Jun 2009 11:27:21 +0100

Whenever my students report that Stata is "not intuitive" they often
appear to mean "unlike Excel", with which I can only agree. Sometimes
they mean something more like "not familiar". 

Also, when people claim that something is not intuitive, they can only
mean "not intuitive to me", as age-old discussions in philosophy and
psychology underline how difficult it is to get a really good handle on
somebody else's intuition, or lack of it. (Of course, you can _discuss_
intuitions, or compare what people _do_ as guides to their intuitions,
but philosophers professionally prefer permanent puzzlement.) 

Any way, there are real psychologists on the list who should know about
this sort of thing, so I will focus on the question. 

In terms of coordinate geometry y conventionally means vertical axis. My
recollection of my reading of the history is that this convention does
go back to Descartes, just as your high school [secondary school [
lyc\'ee [ Gymnasium [ ... ]]]] textbook or teacher may have told you. 

In terms of statistics y conventionally means dependent variable
[response, outcome, criterion, ...], as we all know. It seems that this
convention was solidified by R.A. Fisher in the 1920s. 

These conventions are not usually thought to clash, so that for example
there is a strong convention to plot response on the vertical axis of a
scatter plot (although there can be other conventions too: in the Earth
and environmental sciences it is common to plot height above or depth
below sea level on the vertical axis). This convention is so strong that
statistically minded people often don't think about it and even many
introductory statistics books never spell it out. 

However, in the case of box plots and bar charts there can be some
tension. Both horizontal and vertical flavours are to be found and
everyone seems to agree that the choice between them is essentially
aesthetic or pragmatic, i.e. what looks or works better. (With a graph
that should usually be the same choice.) Often I find myself arguing
that horizontal would be better because then text labels explaining
categories can be indeed horizontal. Otherwise you can get what has been
called giraffe graphics.) 

So, what often happens is also precisely what Liz appears to be doing,
trying out one version and then the other, and seeing which one likes
better. 

Stata's rule with -graph *box- and -graph *bar- is that y means
response, regardless of which geometric axis is used. 

This rule has one very big practical advantage: Change your mind and you
need only change one thing: box to hbox, or vice versa, and similarly
with bar and hbar. (My students have had credit cards since they were
knee-high and usually spell that visa versa.) 

If these programs worked like -twoway-, changing your mind could mean
changing e.g. -yti()- yla() ytic()- to their x-cousins, or vice versa.
Several changes would be needed, which would often be fiddly and
fallible. 

I think that's why it is the way it is. Once you've got used to it, you
will be surprised that you ever found it puzzling (just like, say,
quantum mechanics or cricket). 

On a different note, -stripplot- from SSC has a -box- option but is a
wrapper for -twoway- and follows the -twoway- rules that y increases
upwards and x increases rightwards. 

Nick 
n.j.cox@durham.ac.uk 

Elizabeth Allred

Thanks Scott. 

I see now that hbox and hbar share this odd characteristic--whether the
numeric axis is vertical or horizontal it's the "y" axis. It is
certainly NOT intuitive.

Liz


>>> On 6/11/2009 at  4:06 PM, in message
<c25482390906111306n74396993t1da139037e215e12@mail.gmail.com>, Scott
Merryman
<scott.merryman@gmail.com> wrote:
> With -graph hbox- the numerical is still the y-axis.  Try
> 
> -graph hbox px, over(nxs) yline(70) ylab(50(20)160)-
> 
> Scott
> 
> 
> On Thu, Jun 11, 2009 at 2:58 PM, Elizabeth Allred
> <lizard@hsph.harvard.edu> wrote:
>>
>> I always seem to have difficulty with Stata graphics.
>>
>> I'm drawing several box and whiskers plots. I want to mark a critical
value 
> on each plot and I want the axes and tick marks to be the same on all
of 
> them. Given that my grouping variable has 6 categories and the labels
are 
> rather long, hbox(horizontal boxes) rather than box (vertical boxes)
gives I 
> nicer picture. However, I find I am unable to mark a critical value
with a 
> vertical line nor am I able to specify tick marks when I use hbox.
>>
>> This works fine:
>> graph box px, over(nxs) yline(70) ylab(50(20)160)
>>
>> This does not:
>> graph hbox px, over(nxs) xline(70) xlab(50(20)160)
>>
>> I see absolutely no reason why there shouldn't be "symmetry" in these

> commands.
>>
>> Would somebody suggest a workaround?

*
*   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   |   What's new   |   Site index