The *trimean* contains information about the center and some of the position of the data. See the **Details** section below for further information.
Arguments
- x
(named) numerical vector
- i
(optional) numerical vector giving the position in
x
or character vector matching the names inx
. Ifmissing
ori = NULL
, the entirex
is considered for the computation of the score- na.rm
logical, whether to remove
NA
values fromx
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}$$
Examples
x = c(0,1,1,2,3,3,3,100,NA)
trimean(x = x, na.rm = TRUE)
#> [1] 2.25