fournum {sn} | R Documentation |
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, ...)
Arguments
x |
a numeric vector, maybe including |
na.rm |
logical;
if |
... |
optional arguments passed to |
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:
the median, which corresponds to
oct[4]
,the ‘(coefficient of) quartile deviation’ or semi-interquantile range:
(oct[6] - oct[2])/2
;the Galton-Bowley measure of asymmetry, that is, skewness:
(oct[6] - 2 * oct[4] + oct[2])/(oct[6] - oct[2])
;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).
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 NA
s),
rep(NA,4)
is returned.
Note
Computation of octiles makes real sense only if length(x)
is
substantially larger than 8.
Author(s)
Adelchi Azzalini
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
fournum(datasets::rivers)