wilcoxon test power

Hello!

I want to study the power of the Wilcoxon test for the test :
H0 : Fx = Fy
against H1 : Fx = F1 > Fy = F2

F is the empirical distribution function
F1 = F(normal(0,1)) and F2 = F(normal(0.5,1))

here I'm trying to stimulate 50 samples of Z in order to have their p-values.
The aim is to evaluate using Monte Carlo the power of the Wilcoxon test.

Tn <- function (z,n1) {
  return(abs(mean(z[1:n1])-mean(z[n1+1:length(z)])))
}

pval <- function (z,B,nX){
  boot_sampl = c()
  for (i in 1:B){
    boot_sampl[i] = Tn(sample(z),nX) # bootstrap samples
  }
  p = boot_sampl[boot_sampl>Tn(z,nX)]
  p_val = mean(p)
  return((p_val))
}

Is this correct?

How can I implement the Monte-Carlo method in order to evaluate the power of the Wilcoxon test?

Thank you!

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.