Skip to contents

The *trimean* contains information about the center and some of the position of the data. See the **Details** section below for further information.

Usage

trimean(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

The trimean is defined as a weighted average of the distribution's median and its two quartiles:

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

References

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

Author

Alessandro Barberis

Examples

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