Home
Packages
Datasets
Task Views
R resources
Packages
Toggle theme
Toggle Menu
Home
Packages
highfrequency
MDtest
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 <- (out
y
[
m
a
x
(
w
h
i
c
h
(
o
u
t
y[max(which(out
y
[
ma
x
(
w
hi
c
h
(
o
u
t
x < fmed))] + out
y
[
m
a
x
(
w
h
i
c
h
(
o
u
t
y[max(which(out
y
[
ma
x
(
w
hi
c
h
(
o
u
t
x < fmed))+1])/2 test <- sqrt((m
n)/(m + n))
2
fmedvalue
delta1 return(abs(test) > qnorm(1-alpha/2))
Copy
highfrequency package
Read PDF manual
Maintainer: Kris Boudt
License: GPL (>= 2)
Last published: 2023-10-04
Useful links
https://github.com/jonathancornelissen/highfrequency/issues
https://github.com/jonathancornelissen/highfrequency