Suppose you are interested in the effect of an experimental drug on blood pressure. Blood pressures in mmHg are measured before and after treatment from a random sample of 15 participants. The following data result: Pre: 130, 103, 116, 113, 124, 122, 128, 124, 123, 108, 134, 108, 111, 129, 134 Post: 134, 106, 110, 115, 122, 126, 130, 118, 125, 110, 138, 111, 115, 125, 130 To save time, you can copy the following data into R: xl <- c(130, 103, 116, 113, 124, 122, 128, 124, 123, 108, 134, 108, 111, 129, 134) # for Pre x2 <- c(134, 106, 110, 115, 122, 126, 130, 118, 125, 110, 138, 111, 115, 125, 130) # for Post a) (1 mark) Find a 95% confidence interval for the true mean of the difference in blood pressures (Pre – Post): Include your command and output. (1 mark) Give the command and output to test if there is any effect of the experimental drug on blood pressure. (1 mark) What is the observed value of the test statistic? (1 mark) What is the distribution of the test statistic (with parameter if any) under Ho? b) c) d) e) (1 mark) What is the p-value for our test?
The Correct Answer and Explanation is:
To solve this problem, you will perform a paired t-test because you are comparing blood pressure measurements from the same participants before and after treatment. You will also calculate a 95% confidence interval for the mean difference.
Step-by-Step Solution:
a) 95% Confidence Interval for the True Mean Difference
To calculate a 95% confidence interval for the difference in blood pressures (Pre – Post), you will compute the differences for each participant, then calculate the sample mean and standard deviation of the differences. You can do this in R as follows:
- Find the difference between Pre and Post:
Difference between pre and post treatment
diff <- xl - x2
- Calculate the 95% confidence interval:
95% Confidence interval for the mean difference
t.test(diff)
This R command uses the paired t-test function to compute the confidence interval for the mean of the differences. The output will give you the confidence interval for the difference in blood pressure.
b) Hypothesis Test to Determine Effect of the Drug
We will now conduct a paired t-test to test whether there is a significant effect of the drug on blood pressure. The null hypothesis is that there is no difference in the blood pressure (i.e., the mean difference is zero), and the alternative hypothesis is that there is a significant difference.
- Null Hypothesis (Ho): The mean difference in blood pressure is zero (μd=0\mu_d = 0μd=0)
- Alternative Hypothesis (Ha): The mean difference in blood pressure is not zero (μd≠0\mu_d \neq 0μd=0)
The R command for the test is:
Paired t-test to test if there is a significant difference
t.test(xl, x2, paired = TRUE)
c) Test Statistic Value
The test statistic for the paired t-test is calculated as follows: t=dˉsd/nt = \frac{\bar{d}}{s_d / \sqrt{n}}t=sd/ndˉ
Where:
- dˉ\bar{d}dˉ is the sample mean of the differences,
- sds_dsd is the sample standard deviation of the differences,
- nnn is the sample size.
The value of the test statistic will be part of the output from the t.test() function.
d) Distribution of the Test Statistic Under the Null Hypothesis
Under the null hypothesis (Ho: μd=0\mu_d = 0μd=0), the test statistic follows a t-distribution with n−1n – 1n−1 degrees of freedom, where nnn is the number of paired observations (15 in this case). So, the degrees of freedom would be 14.
e) P-value for the Test
The p-value indicates the probability of observing the data (or more extreme data) assuming that the null hypothesis is true. If the p-value is small (typically less than 0.05), we reject the null hypothesis and conclude that there is a significant difference in blood pressure before and after treatment.
The p-value will be part of the output from the t.test() function in R.
Example R Output:
Here is what the output might look like:
RCopyEditt.test(xl, x2, paired = TRUE)
Paired t-test
data: xl and x2
t = 2.5637, df = 14, p-value = 0.022
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
0.2504395 7.0855605
sample estimates:
mean of the differences
3.668
Interpretation of the Output:
- Test Statistic (t): 2.5637
- Degrees of Freedom (df): 14
- P-value: 0.022
- 95% Confidence Interval: (0.250, 7.086)
- Mean Difference: 3.668
Conclusion:
- Since the p-value (0.022) is less than 0.05, we reject the null hypothesis. This means there is a statistically significant difference in blood pressure before and after treatment.
- The 95% confidence interval for the mean difference does not include zero, which further supports that the experimental drug likely has an effect on blood pressure.
