-------------------------------------------------------------------------------
help for extremes
-------------------------------------------------------------------------------

List extreme values of a variable

extremes numvar [other_vars] [if exp] [in range] [ , n(#) { frequencies | iqr[(#)] } high low list_options ]

by ...: may be used with extremes; see help by.

Description

extremes lists extreme values of numvar. If other_vars are also specified, these are also listed for the same observations. By default, the extremes are the 5 lowest and the 5 highest values of numvar. The option n() may be used to change 5 to any other integer. The option iqr, used with or without an argument, may be used to select extremes according to their distance from the nearer quartile. The option frequencies may be used to show the frequencies of distinct extreme values. Missing values are ignored.

Options

n(#) specifies a number of values to be shown in each tail. n defaults to 5.

frequencies specifies that frequencies of distinct values be shown. That is, imagine the variable treated as discrete and shown as a histogram. The table shows the frequencies that would be shown as the n leftmost and/or the n rightmost bars of the histogram. other_vars may not be specified with this option.

iqr is short-hand for iqr(1.5). See just below.

iqr(#) specifies use of a rule based on iqr (interquartile range) for identifying extremes. That is, calculate

(value - upper quartile ) / iqr

for any values at or above the upper quartile and

(value - lower quartile) / iqr

for any above at or below the lower quartile. Values will be shown if this ratio equals or exceeds # in absolute value. iqr(1.5) corresponds to a common rule for identifying individual points on box plots. # may be 0 or positive.

frequencies may not be combined with iqr or iqr().

high specifies that only high values should be shown.

low specifies that only low values should be shown.

list_options are options of list other than noobs and subvarname.

Examples

. extremes price make

. extremes price make, iqr

. extremes price make, iqr(3)

. bysort foreign: extremes price make, iqr

Author

Nicholas J. Cox, University of Durham, U.K. n.j.cox@durham.ac.uk

Acknowledgement

This program owes a debt to Michael N. Mitchell's hilo. A problem posed by Sylvain Friederich led to tabulation by frequencies.

Also see

On-line: help for list, hilo (if installed), adjacent (if installed)