Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: boxplot


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: Re: boxplot
Date   Tue, 6 Aug 2002 11:53:16 +0100

Olivia Keiser <[email protected]>

Is it possible to omit the extreme values in the boxplot?

I've found the option 'symbol(i)' where the outliers are not plotted
but
the axis scale still remains large (and with yscale I can't make it
smaller).
If I include the 'if', the graph looks nicer, but all the extreme
values
are not included to calculate the boxplots.

I would need something that includes all the values for the
calculation,
but only plots the boxplots on a reasonable scale (like tmax() in sts
graph).

>>> I am not sure that I approve of this!

However, it would seem that you would need to copy
your variable into another

gen myvar2 = myvar

and to replace

1. the maximum (and any other high extreme values) by a value
which is the upper quartile + epsilon.

2. the minimum (and any other low extreme values) by
a value which is the lower quartile - epsilon.

That way, the median and the quartiles, and thus the length of the
box,
and thus the lengths of the whiskers would be unchanged and your
modified
extremes would be hidden by the whiskers.

If you are doing this

graph myvar, by(byvar)

you will need to do this for each group of byvar.

I haven't tried this but I think it should work.

Nick
[email protected]

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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