Created
March 26, 2020 02:29
-
-
Save daskelly/aa5be568629bbdb3a1cb06dc8584f7ac to your computer and use it in GitHub Desktop.
Simple code for a t-test with unequal variance on ranked values
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
wilcox_unequal_var <- function(x, y, ...) { | |
# The Wilcoxon rank sum test (Mann Whitney U test) does not perform | |
# that well on data where the variances are unequal. Some | |
# investigators have recommended as an alternative performing the | |
# unequal variance t-test on ranked values. See | |
# https://academic.oup.com/beheco/article/17/4/688/215960 | |
# https://psycnet.apa.org/doiLanding?doi=10.1037%2Fh0078850 | |
rr <- rank(c(x, y)) | |
nx <- length(x) | |
t.test(rr[1:nx], rr[(nx+1):length(rr)], var.equal=FALSE, ...) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment