# Re: st: boxplot

 From Lars Korsholm <[email protected]> To [email protected] Subject Re: st: boxplot Date Tue, 6 Aug 2002 12:33:27 +0200 (MEST)

```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
> Olivia

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
invisible option.
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)' )
gen X2=X1
replace X2= `u' + 0.1 if X2> `u'
replace X2= `l' - 0.1 if X2< `l'

gr X2, box symbol(i)

Best Lars

PS On a PC you might have to change my ' to a more vertical looking
character.

............................................
: 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 protected]              :
: Web     http://www.isd.sdu.dk/~korsholm  :
:..........................................:

*
*   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/
```