How to compute the power of Wilcoxon test? I am using Wilcoxon test to compare two paired sets of data for whether their means differ. Besides the p-value, I would also like to know the power of this test. How to compute it in R? Thank you in advance.
 A: I don't know if there's an analytical solution to your question, but when all else fails, one can simulate the distribution you think the two samples come from many thousands of times using Monte Carlo methods. The percentage of those samples the Wilcoxon test correctly identifies as "different" is the power of the test. For example, if you generated 10,000 different simulated paired samples that match your actual data in terms of size and the distribution they came from, and 8,000 of them are correctly identified by the test as different, your power = 0.80.
A: Suppose you have Ho: median <= 8 and Ha: median > 8
As par for the course, remove any values from your data equal to 8.
Calculate the sample mean and sample standard deviation. Use the sample mean as your alternate mean for the power calculation.
In my data, n=9 (df = 8) and I'm testing at alpha = 5%. The t critical value is 1.86.
Also, the sample mean from my data is 12.7333333... and the sample standard deviation is 7.79527429.
Calculate X1 = 1.86(7.97527429)/sqrt(9) + 8 = 12.94467006
Calculate t1 = 12.94467006 - 12.733333.... = 0.211336726
Then, power = P(t > 0.211336726) = 0.491 based on df = 8.
I found this procedure here:
https://ncss-wpengine.netdna-ssl.com/wp-content/themes/ncss/pdf/Procedures/PASS/Wilcoxon_Signed-Rank_Tests.pdf
However, they are using a non-central t distribution which only complicates the matter.
