Exercise

Nonparametric methods: The Wilcoxon Signed-Rank Test (2)

Our Wilcoxon signed-rank test is the nonparametric equivalent of the dependent t test. It actually calculates a difference score between the ratings of the first beer, the IPA, and the ratings of our second beer, the wheat beer. As these beers are rated on a scale from 1 to 5, we regard a score of 5 as the highest possible score and a score of 1 as the lowest possible score. The largest possible difference score thus is 4.

Above are displayed the scores that our test panel of 3 individuals gave to each of the beer. From all the scores, the difference score is calculated. In the example, this is done by detracting the score of the wheat beer from the IPA. This is done in the fourth column. Finally, the differences are ranked. Here, difference scores of zero are usually ignored.

In R, you can perform a Wilcoxon signed-rank test with the function wilcox.test(). You can give this function two different vectors with scores. Also, you have to set the paired parameter to TRUE. If we would use this test on the data a provided in the table, we could do so in the following way: wilcox.test(c(5, 4, 5), c(1, 2, 2), paired = TRUE). We can also specify the alternative parameter. By default this is set to "two.sided" meaning that we are doing a two-sided test. If you want to check whether you first vector is greater than your second vector, you change this to "greater".

Instructions

100 XP
  • There are two vectors available in your console. The vector score_ipa contains the scores that participants gave to the IPA. The vector score_wheat contains the scores that participants gave to the wheat beer. Perform a Wilcoxon signed-rank test using the function wilcox.test(). You actually want to test the hypothesis whether the IPA was appreciated to a greater extent by the test panel then the wheat beer.
  • Assign your conclusion to the variable conclusion. Is the null hypothesis that the IPA and the wheat beer are equally appreciated accepted or rejected. Assign either "rejected" or "accepted" to the variable conclusion.