Thursday, 8 March 2018

Hypothesis Testing Question 9 - Wilcoxon Signed Rank Test

How to Conduct Wilcoxon Signed Rank Test
Question
Blood pressure reading of ten patients before and afer medication for reducing the blood pressure are as follows

Patient: 1,2,3,4,5,6,7,8,9,10
Before treatment: 86,84,78,90,92,77,89,90,90,86
After treatment:    80,80,92,79,92,82,88,89,92,83

Test the null hypothesis of no effect agains the alternate hypothesis that medication is effective. Execute it with Wilcoxon test


Solution Steps
Get the Excel sheet for this problem here
Step 1: State the null and alternate hypethesis and accptance criteria
H0: difference between the pairs of observation follows a symetric distribution around 0
H1: difference between the pairs does not follow a symetric distribution around 0

Step 2: Calculate the differences between the pairsof measurements
I have done this using Microsof Excel and the result is shown below


Step 3: Calculate the absolute values of the differences
In this step, you simply remove the negative signs from the negative differences
An optional addion is to add a column that holds the signs of each of the differences. This is shown in the table below

Step 4: Rank the differences
Rank the absolute values of the differences. This is the |X-Y| column.
Values where the differnce is zero is ignored
For values where there is tied ranks, the mid-point of the two ranks is assigned to both values. For example, for values of 1, and 1, the rank of 1.5 is assigned to both values and 3 is assigned to the next rank.

Step 5: Calculate the signed ranks
This signed rank is gotten by multiplying the ranks with the corresponding signs in the sign column.
The table would now look like the one below



Step 6: Calculate Sum of Ranks
Calculate  the sum of ranks for the positive differences as given below

W+  = 3+ 5+2+8.5+8.5+6  = 31

Calculate teh sum of ranks for the negative differences

W- = 1+4+7 = 12

The smaller of the two is used as the test statistics.

W = 12

Step 7: Look up the z-Table and Compare
Get Statistical table from here