### H0: median = tau vs Ha: median > tau
### Normal approximation
tau<-0.015
N <-20
x <- rnorm(N, 0.05, 0.1)
V <- sum(rank(abs(x-tau))[x-tau>0])
M <- N*(N+1)/4
sigma <- sqrt(N*(N+1)*(2*N+1)/24)
Z <- (V - M) / sigma
p_value <- 1-pnorm(Z)
wilcox.test(x, alternative="g", mu=tau)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment