We will use R to perform the hypothesis test using the Wilcoxon Signed Rank Test.
The expected median age for the onset of diabetes is 45 years. The following is a list of 30 people tracking their onset of diabetes. Test whether the evidence supports the hypothesis.
diab <- c(35.5, 44.5, 39.8, 33.3, 51.4, 51.3, 30.5, 48.9, 42.1, 40.3, 46.8, 38.0, 40.1, 36.8, 39.3, 65.4, 42.6, 42.8, 59.8, 52.4, 26.2, 60.9, 45.6, 27.1, 47.3, 36.6, 55.6, 45.1, 52.2, 43.5)
The Null Hypothesis, H0: Median equals 45
The Alternate Hypothesis, H1: Median does not equal 45
wilcox.test(diab, mu = 45.0, alternative = "two.sided")
Wilcoxon signed rank exact test
data: diab
V = 200, p-value = 0.5158
alternative hypothesis: true location is not equal to 45
The p-value is 0.51, which is higher than 0.05 (5% significance), and therefore, the null hypothesis can not be rejected.
Since the histogram of the data appears reasonably normal, it would be interesting to test using the parametric method, such as the t-test.
t.test(diab, mu = 45.0, alternative = "two.sided")
One Sample t-test
data: diab
t = -0.54461, df = 29, p-value = 0.5902
alternative hypothesis: true mean is not equal to 45
95 percent confidence interval:
40.51408 47.59925
sample estimates:
mean of x
44.05667