From my Advanced Business Data Analysis module we learned how to compare two groups using the Mann-Whitney U Test. This is a non-parametric test which indicates that we can't use parameters like "mean" and "variance" to compare the groups as in a Student t Test - usually because the data are not normally distributed. I don't require my own students to be able to do this by hand - we use SPSS and R in class to do this. Nevertheless, showing and learning how to do it by hand gives a good understanding of how this rank-based test works.
If you want to perform the test described in the video above in R, you just need three lines of code as follows:
TreatmentA <- -="" c="" font="">->
wilcox.test(TreatmentA, TreatmentB)
Note: the wilcox.test() function is used for both paired and unpaired tests.
The above code will generate the following output at the R console:
Wilcoxon rank sum test with continuity correction
data: TreatmentA and TreatmentB
W = 2, p-value = 0.01244
alternative hypothesis: true location shift is not equal to 0
The "W" value of "2" is the same result as in the video when calculation "U".
No comments:
Post a Comment