Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: box plot with 2nd variable


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: box plot with 2nd variable
Date   Mon, 18 Aug 2008 18:43:51 +0100

BTW, although I use the mean of the same variable here, there is no
syntax or other reason why you could not use the mean of another
variable. It's just that I started using mpg and there's no other
variable in the auto data which has the same units. 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: 18 August 2008 18:34
To: [email protected]
Subject: st: RE: box plot with 2nd variable

I think the answer is No with -graph box-. 

With -stripplot- from SSC you can do things like this: 

. sysuse auto
(1978 Automobile Data)

. egen mean = mean(mpg), by(rep78)

. sort rep78

. stripplot mpg, over(rep78) vertical stack box addplot(line mean rep78)

. stripplot mpg, over(rep78) vertical stack box addplot(connect mean
rep78)

which sounds similar to what you want. There are several other options:
see the help. 

-stripplot- has a built-in tendency to showing all data points, not just
those beyond quartiles +/- 1.5 IQR. It is not designed as a clone of
-graph box-, but it shares some features. 

Nick 
[email protected] 

Cathy L. Antonakos

I am wondering if it is possible to add a connected line to a box plot.
The line would connect points representing the average value of a second
variable for each group.

The syntax I am using without the second variable is:

graph box index, over(id)



*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index