Learn R Programming

sn (version 2.1.1)

fournum: Four-number summary of a numeric vector

Description

Returns a quantile-based four-number summary of the input data

Usage

fournum(x, na.rm = TRUE, ...)

Value

a vector of length four containing the median, the quartile deviation, the Galton-Bowley measure and the Moors measure. However, if x does not contain at least 8 values (after removing NAs),

rep(NA,4) is returned.

Arguments

x

a numeric vector, maybe including NAs and +/-Inf's. At least 8 not-NA values are required. It works with objects which can be coerced to vector.

na.rm

logical; if TRUE, all NA and NaNs are dropped, before the statistics are computed.

...

optional arguments passed to quantile

Author

Adelchi Azzalini

Details

Function quantile is used to compute 7 octiles of x, that is, quantiles of level (1:7)/8, denoted oct[1:7], and derive four summary quantities:

  1. the median, which corresponds to oct[4],

  2. the ‘(coefficient of) quartile deviation’ or semi-interquantile range: (oct[6] - oct[2])/2;

  3. the Galton-Bowley measure of asymmetry, that is, skewness: (oct[6] - 2 * oct[4] + oct[2])/(oct[6] - oct[2]);

  4. the Moors measure of kurtosis: (oct[7] - oct[5] + oct[3] - oct[1])/(oct[6] - oct[2])

The term ‘coefficient of quartile deviation’ is adopted from the Encyclopedia of Statistical Sciences; see the references below. What is called Galton-Bowley measure here is often named ‘Bowley's measure’, but some sources attribute it to Francis Galton. For the Moors measure, see Moors (1988).

References

‘Quartile deviation, coefficient of’, in: Encyclopedia of Statistical Sciences, 2nd edition (2006). Editors: Samuel Kotz (Editor-in-Chief), Campbell B. Read, N. Balakrishnan, Brani Vidakovic. Volume 10, p.6743.

‘Skewness, Bowleys's measures of’, in: Encyclopedia of Statistical Sciences, 2nd edition (2006). Editors: Samuel Kotz (Editor-in-Chief), Campbell B. Read, N. Balakrishnan, Brani Vidakovic. Volume 12, p.7771-7773.

Moors, J.J.A. (1988). A quantile alternative for kurtosis. Source: Journal of the Royal Statistical Society. Series D (The Statistician), Vol. 37, pp. 25-32

See Also

Examples

Run this code
fournum(datasets::rivers)

Run the code above in your browser using DataLab