0
0
SciPydata~10 mins

Wilcoxon signed-rank test in SciPy - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the Wilcoxon test function from scipy.

SciPy
from scipy.stats import [1]
Drag options to blanks, or click blank then click option'
Awilcoxon
Bttest_rel
Cmannwhitneyu
Dpearsonr
Attempts:
3 left
💡 Hint
Common Mistakes
Importing the wrong test function like ttest_rel or mannwhitneyu.
Trying to import from the wrong module.
2fill in blank
medium

Complete the code to perform the Wilcoxon signed-rank test on two related samples, sample1 and sample2.

SciPy
stat, p = wilcoxon([1], sample2)
Drag options to blanks, or click blank then click option'
Asample1
Bdata1
Cx
Dvalues1
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name that is not defined or unrelated.
Swapping the order of samples incorrectly.
3fill in blank
hard

Fix the error in the code to correctly perform the Wilcoxon test on two samples named before and after.

SciPy
result = wilcoxon(before, [1])
Drag options to blanks, or click blank then click option'
Abefor
Bafter
Cafter_data
Dbefore
Attempts:
3 left
💡 Hint
Common Mistakes
Misspelling variable names like 'befor'.
Using the wrong variable for the second sample.
4fill in blank
hard

Fill both blanks to create a dictionary with test statistic and p-value from the Wilcoxon test result.

SciPy
result_dict = {'statistic': result.[1], 'p_value': result.[2]
Drag options to blanks, or click blank then click option'
Astatistic
Bpvalue
Cp_value
Dstat
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect attribute names like 'p_value' or 'stat'.
Confusing the attribute names with variable names.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that stores the Wilcoxon test results for multiple paired samples in data_dict.

SciPy
results = [1]: wilcoxon(data_dict[[2]][0], data_dict[[3]][1]) for [1] in data_dict}
Drag options to blanks, or click blank then click option'
Akey
B'sample1'
C'sample2'
Ditem
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently.
Using string literals instead of variables to access dictionary keys.