MDtest function

Difference of medians test # See Fried (2012) # Returns TRUE if H0 is rejected # importFrom stats density # keywords internal DMtest <- function(x, y, alpha = 0.005) m <- length(x) n <- length(y) xmed <- median(x) ymed <- median(y) xcor <- x - xmed ycor <- y - ymed delta1 <- ymed - xmed out <- density(c(xcor, ycor), kernel = "epanechnikov") fmed <- as.numeric(BMS::quantile.density(out, probs = 0.5)) fmedvalue <- (outy[max(which(outy[max(which(outx < fmed))] + outy[max(which(outy[max(which(outx < fmed))+1])/2 test <- sqrt((mn)/(m + n))2fmedvaluedelta1 return(abs(test) > qnorm(1-alpha/2))