One week later, after the first aspirin has presumably been cleared from the system, the same dosage of the other aspirin is given to the same person and the 1-hour urine concentration is noted. Because the order of giving the drugs may affect the results, a table of random numbers is used to decide which of the two types of aspirin to give first. This experiment is performed on 10 people; the results are given in the following table.
a.Suppose we want to test the hypothesis that the mean concentrations of the two drugs are the same in urine specimens. State the appropriate hypothesis.
b.Test the hypothesis using a paired t-test, report the p-value and state your conclusion (alpha = 0.05)
c.Suppose that you tested this hypothesis using a two-sample t-test (instead of a paired t-test). What would the p-value of your test have been?
Solution 1
A: STATING THE HYPOTHESIS:
H0:μa=μb
Ha:μa≠μb
Where μa & μb = mean concentrations of Aspirin A & B in a subject’s specimen
B: TESTING HYPOTHESIS USING PAIRED T-TEST:
Finding correlation between samples:
## [1] 0.9338095
## [1] 19.2
## [1] 15.6
A positive correlation of 93.3% shows paired data
Now, Performing Paired T-Test:
##
## Paired t-test
##
## data: AspirinA and AspirinB
## t = 3.6742, df = 9, p-value = 0.005121
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
## 1.383548 5.816452
## sample estimates:
## mean difference
## 3.6
The p-value of paired t-test is 0.005121
Since p-value (0.005121) < α (0.05), we can reject the Null hypothesis
C: TESTING HYPOTHESIS USING 2 SAMPLE T-TEST:
?t.test
##
## Welch Two Sample t-test
##
## data: AspirinA and AspirinB
## t = 0.9802, df = 17.811, p-value = 0.3401
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -4.12199 11.32199
## sample estimates:
## mean of x mean of y
## 19.2 15.6
The p-value of Two sample t-test is 0.3401
Since p-value (0.3401) > α (0.05), we fail to reject Null Hypothesis
2. Can active exercise shorten the time that it takes an infant to learn how to walk alone? Researchers randomly allocated 12 one-week old male infants from white, middle class families to one of two treatment groups. The active exercise group received stimulation of the walking reflexes for four 3-minute sessions each day from the beginning of the second week through the end of the eighth week. Those in the other group received no such stimulation. Is there sufficient evidence to conclude that the mean time to walk is less for children who receive Active Exercise versus No Exercise?
State the null and alternative hypothesis
Why might you want to use a non-parametric method for analyzing this data?
Analyze using the Mann-Whitney-U test using R with alpha=0.05
Solution:
A: STATING THE HYPOTHESIS:
Null: H0: μA = μB OR μA - μB = 0
Alte: Ha: μA < μB OR μA - μB < 0
Where μA = mean time to walk in months for the ‘active exercise group’ & μB = mean time to walk in months for the ‘non-stimulated Ones’
B: Why use a non-parametric method:
## [1] 6
## [1] 6
From the probability plots, we cannot assure if data follows straight line (normality) with only six data points.(Sample size is small).For this reason, the non-parametric method could be used to analyze this data.
C: using the Mann-Whitney-U test AKA Wilcoxon rank sum test:
##
## Wilcoxon rank sum test with continuity correction
##
## data: A and B
## W = 9, p-value = 0.08523
## alternative hypothesis: true location shift is less than 0
p=0.1705 and Test Statistic W=9
Since p-value (0.08523) > α (0.05), we fail to reject the Null hypothesis.
{...{r eval=FALSE} {r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE) {r} AspirinA <- c(15,26,13,28,17,20,7,36,12,18) AspirinB <- c(13,20,10,21,17,22,5,30,7,11) {r} cor(AspirinA,AspirinB) a <- mean(AspirinA) b <- mean(AspirinB) a b {r} t.test(AspirinA,AspirinB,paired = TRUE) {r} t.test(AspirinA,AspirinB) {r} A <- c(9.5,10,9.75,9.75,9,13) B <- c(11.5,12,13.25,11.5,13,9) {r} length(A) length(B) qqnorm(A,main="Active Exercise") {r} qqnorm(B,main="No Exercise") {r} wilcox.test(A,B,alternative = "less", exact = FALSE) ...