x <- c(2, -1, 3, 0, 4, -2, 1, 5, -3, 2)Post Midterm 2 Practice Problems
Nonparametric Statistics
Sign Test
Exercise 1 (Sign Test) A physiotherapist wants to test whether a new stretching routine improves flexibility. She records the change in forward reach (cm) for 10 patients (after − before):
State the hypotheses
Remove any observations if necessary.
Calculate the \(p\)-value for the sign test at \(\alpha = 0.05\)
State a conclusion in context
Wilcoxon Signed-Rank Test
Exercise 2 (Wilcoxon Signed-Rank Test) A study measures reaction time (ms) before and after caffeine consumption:
before <- c(250, 300, 275, 290, 310, 260)
after <- c(240, 310, 260, 280, 295, 255)
dat <- data.frame(subject = 1:6, before, after)
datDefine the differences (After − Before)
Rank the absolute differences
Compute the test statistic
Use the appropriate R function to find a \(p\)-value for this test.
State the Decision and Conclusion in context.
Why might this test be preferred over the sign-test?
Mann-Whitney U Test (aka Wilcoxon Rank-Sum)
Exercise 3 (Mann–Whitney Test) A tennis coach compares serve speeds (km/h) between two training programs:
A <- c(110, 115, 120, 125, 130) # Program A
B <- c(105, 108, 112, 118, 122) # Program BAssuming these groups are independent, perform the appropriate non-parameteric test to determine whether there is a difference in serve speeds between the two training programs.
State the hypotheses
Rank the observations
Compute the test statistic
Decision and conclusion in context.
Why is this test preferred?
Kruskal–Wallis Test
Exercise 4 (Kruskal–Wallis Test) A researcher compares pain scores (lower = better) across three treatments:
A <- c(3, 4, 5) # Treatment A
B <- c(2, 3, 4) # Treatment B
C <- c(6, 7, 8) # Treatment CState hypotheses
Rank all data
Compute the Kruskal–Wallis statistic
Compare to \(\chi^2\) with appropriate df
Perform the test in R
State the conclusion in context
Note to self: next year if there is time add some post-hoc tests here
Miscellaneous
Exercise 5 (Conceptual Multiple Choice) Which of the following is TRUE?
- The sign test uses magnitudes of differences
- The Wilcoxon signed-rank test assumes normality
- The Mann–Whitney test compares medians (under similar shapes)
- The Kruskal–Wallis test requires equal variances
Exercise 6 (Interpretation (non-significant result)) A Mann–Whitney test comparing two diets gives:
p = 0.18
State the statistical decision
Write a proper contextual conclusion
Why is “no difference exists” incorrect?
Exercise 7 (Choosing the Right Test) For each scenario, choose the most appropriate test:
Paired data, only direction of change matters
Two independent groups, skewed data
Three independent groups, ordinal outcome
Paired data, want to account for magnitude of change
Exercise 8 (Assumptions (important conceptual)) The Mann–Whitney test is often interpreted as a test of medians.
What assumption is required for this interpretation?
What does the test actually test without that assumption?
Give an example where this interpretation would fail
Exercise 9 (Small Data, Exact Thinking) You observe paired differences:
+, +, +, -, +
Perform an exact sign test to determine whether the median difference between pairs is positive.
Compute the exact p-value
Would you reject at \(\alpha = 0.05\)?
Exercise 10 (Extension / Critical Thinking) Explain:
Why might a nonparametric test be less powerful than a parametric test when assumptions do hold?