Get startedGet started for free

Wilcoxon signed-rank test

Here, you've been provided with a small DataFrame (podataframe) containing information on 15 Fields. We are interested in potato yield in tons/hectare, as seen in previous lessons. For each Field, we have a value for Yield2018, before the application of a new fertilizer, and Yield2019, after the application of the new fertilizer. However, the variation between fields is very large and the difference between the years seems small, as seen below.

Boxxplots of potato production from two different years

A paired t-test has been performed and its result is stored as ttestpair. A Shapiro-Wilks test has been performed on each Year's yield, shap2018 and shap2019. Does the yield differ significantly between years? scipy.stats is loaded into the workspace as stats.

This exercise is part of the course

Performing Experiments in Python

View Course

Exercise instructions

  • Print the paired t-test result.
  • Print the result of the two Shapiro-Wilk tests.
  • Perform a Wilcoxon signed-rank test to compare Yield2018 and Yield2019.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Print t-test result
print(____)

# Print Shapiro-Wilk test results
print(____)
____

# Perform Wilcoxon Signed-Rank test
wilcsr = stats.wilcoxon(____)
____
Edit and Run Code