Last active
March 11, 2022 13:59
-
-
Save DrNickRedfern/7a3c553b724714fe483181d02f7801eb to your computer and use it in GitHub Desktop.
Calcualate a trimean using Harrell-Davis quantile estimator (default = Tukey's trimean)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trimean <- function(x, p = 0.25, a = 0.25){ | |
q <- Hmisc::hdquantile(x, probs = c(p, 0.5, 1-p), na.rm = TRUE, names = FALSE) | |
tm <- (a * q[1]) + ((1 - (2 * p)) * q[2]) + (a * q[3]) | |
return(tm) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment