[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: boxplot
On Tue, 6 Aug 2002, Olivia Keiser wrote:
> 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).
> Thanks for your help
If you want to program it by hand
you could just change the low values to be just outside the lower bar and
the large values to bo just above the upper bar. And then plot with the
Here is some details:
-centile ..., centile(25 50 75)-
leaves behind locals (se -return list-)
that can be used.
I think stata defines the points to be plotted as single points as those
larger than median + 1.5 * IQR
(and similar at small values)
via centile you can get hold of these two values.
Call them `u' and `l'
If your vaiable of intresset is X1
you could do:
centile X1, centile(25 50 75)
local u = `r(c_2)' + 1.5*( `r(c_3)'-`r(c_1)' )
local l = `r(c_2)' - 1.5*( `r(c_3)'-`r(c_1)' )
replace X2= `u' + 0.1 if X2> `u'
replace X2= `l' - 0.1 if X2< `l'
gr X2, box symbol(i)
PS On a PC you might have to change my ' to a more vertical looking
: Lars Korsholm Ph.D., :
: Department of Statistics and Demography :
: University of Southern Denmark :
: Sdr. Boulevard 23A, 1. :
: DK-5000 Odense C :
: Phone +45 6550 3608 :
: Fax +45 6595 7766 :
: Mail email@example.com :
: Web http://www.isd.sdu.dk/~korsholm :
* For searches and help try:
- st: boxplot
- From: Olivia Keiser <Olivia.Keiser@hospvd.ch>