Statistics – Wilcoxon sign rank test
I had a communication with a medical researcher from Karolinska Institute this week, and she wondered about why there is a Z-test even if the sample is very small (8 cases).
Let’s start by explaining the test and when to use it.
If you have followed up cases so you have a measurement before and after a period, and then want to test if there has been any significant change – then you can use pairwise test. You can either use pairwise t-test if the differences are normal distributed or you can use the nonparametric test: “Wilcoxon Signed Ranks Test” if you have skewed differences or ordinal scaled variables.
Here is my data example, 6 individuals have been measured twice with a satisfaction score from 1-20. I would like to see if the cases has been significantly more satisfied after a period. If you have a look it seems that only case nr 4 has got a lower score after, and the rest has get a higher score (dicreased satisfaction). Has the satisfaction increased significant over time?
I will use Wilcoxon signed rank test and the test is working with ranks, so that means that you don’t have to be afraid of outliers that could mislead the result. Here you can see how the ranks will be done, so you understand the result:
Here is the command (note that you can also used the newer command “Related Samples”):
Then you choose your pair of variables (same variable measurement repeated for every case):
So it will look like this:
Tips: If you want Another order of the variables you have to paste the command into the syntax by clicking on the “Paste”-button instead of OK (see syntax below)
After running the command you will get this result:
We have only one decrease and 5 increases. SPSS will sum the ranks and you can compare the mean ranks. But the Z-test will use the lowest rank sum in the formula, in this case 2,00 and then it will take in consideration the number of cases in the formula – so if you have few cases like in my example it’s harder to get a significant result compared if you had a bigger sample.
The p-value or significance value is 0.074 and is not significant, (as it is bigger than 0.05) so we cannot say that we have got a significance difference between the scores before compared to scores after.
Answer of the user’s question, why is z-test used when the sample is so small?: The only available test value for Wilcoxon Ranks Signed Test is Z, and normally this Z-test is used in bigger samples (as you mentioned), but in this case the caclulation is taking in consideration the number of cases in the formula so it’t not the same calculation as t-test or p-test.
If you rather want to use a more strict test that is common when you have small samples, then use “Exact test” (if you have the module you will find the button in the dialog box in all nonparametric tests in the legacy dialogs). Here is how you do:
And here is the result, and as you see the significance-value (p-value) is now: 0.094 and could be presented instead of 0.074 – but mention in the text that it’s an Exact test you have done. Still not a significant result as the significance-value is higher than 0.05.
Thanks for watching and welcome to send your statistical questions to your contact person at Crayon.