Skip to contents

The *midhinge* of a set of values is the mean of the first and third quartiles. See the **Details** section below for further information.

Usage

midhinge(x, i = NULL, na.rm = TRUE)

Arguments

x

(named) numerical vector

i

(optional) numerical vector giving the position in x or character vector matching the names in x. If missing or i = NULL, the entire x is considered for the computation of the score

na.rm

logical, whether to remove NA values from x before computation

Value

A numerical value representing the computed measure. A default NA value is returned if the score can't be computed.

Details

This measure of location is computed as:

$$MH(x) = \frac{Q_{1}(x) + Q_{3}(x)}{2} = \frac{median(x) + midhinge(x)}{2}$$

It is related to the interquartile range (\(IQR = Q_{3} - Q_{1}\)), which is a measure of dispersion.

Since missing values and NaN's are allowed only if na.rm = TRUE in quantile, if x has NA values and na.rm = FALSE then NA is returned.

References

https://en.wikipedia.org/wiki/Midhinge

Author

Alessandro Barberis

Examples

x = c(0,1,1,2,3,3,3,100,NA)
midhinge(x = x, na.rm = TRUE)
#> [1] 2