5.2 Solutions
5.2.0.1 Exercise 1
You sample 120 people and measure their blood pressure before and after an intervention and find that the mean change is -5.09 with a standard deviation of 16.71. Find the 95% and 99% confidence intervals of the mean change. Does the intervention reduce blood pressure in the population?
We have all what we need:
- Sample size: 120
- Mean: -5.09
- SD: 16.71
To estimate the confidence interval, we can use that information
<- 16.71/sqrt(120)
se.X
## 95% confidence interval
.1 <- -5.09 - (1.96*se.X)
lb.1 <- -5.09 + (1.96*se.X)
ub.1 lb
[1] -8.079798
.1 ub
[1] -2.100202
## 99% confidence interva;
.2 <- -5.09 - (2.58*se.X)
lb.2 <- -5.09 + (2.58*se.X)
ub.2 lb
[1] -9.025551
.2 ub
[1] -1.154449
Now, because none of the 95% or the 99% confidence intervals include zero, we can reject the null hypothesis that the difference is equal to zero. It is very likely that the intervention reduces blood pressure.
5.2.0.2 Exercise 2
- In the same sample of 120 people you find that 61% showed a decreased in blood pressure. Find the 95% and 99% confidence intervals of the proportion. Does this confirm the effect of the intervention on blood pressure? Note that in this case you need to estimate the standard error of a proportion
Remember that the standard error of a proportion is estimated differently:
\[ se_\pi = \sqrt{\frac{p(1-p)}{n}} \]
where \(p\) is the proportion and \(n\) is the sample size. Therefore, here is how you do it in R
<- sqrt(0.61*(1-0.61)/120)
se.pi
## 95% confidence interval
<- 0.61 - (1.96*se.pi)
lb.pi <- 0.61 + (1.96*se.pi)
ub.pi lb.pi
[1] 0.5227305
ub.pi
[1] 0.6972695
## 99% confidence interval
<- 0.61 - (2.58*se.pi)
lb.pi2 <- 0.61 + (2.58*se.pi)
ub.pi2 lb.pi2
[1] 0.4951248
ub.pi2
[1] 0.7248752
5.2.0.3 Exercise 3
A random sample of 25 countries finds that the mean life expectancy is 64 years for women with a standard deviation of 21 years and 62 years for men with a standard deviation of 14 years. Using a t-distribution, find the 95% and 99% confidence intervals of the mean for men and for women. Interpret your results. (Note: You can use the qt()
function to figure out the right t-score)
The procedure is pretty similar as above, but you will need to estimate the t-score for the appropriate sample size.
# First, we estimate the relevant t-scores for df= 24
.95 <- qt(0.975, df=24)
t.99 <- qt(0.995, df=24)
t
# CI for men
<- 14/sqrt(25)
se.man .95 <- 62 + (t.95*se.man)
ub.men.95 <- 62 - (t.95*se.man)
lb.men.99 <- 62 + (t.99*se.man)
ub.men.99 <- 62 - (t.99*se.man)
lb.men
## 95% CI for men:
.95 ub.men
[1] 67.77892
.95 lb.men
[1] 56.22108
## 99% CI for men
.99 ub.men
[1] 69.83143
.99 lb.men
[1] 54.16857
# CI for women
<- 21/sqrt(25)
se.woman .95 <- 61 + (t.95*se.woman)
ub.women.95 <- 61 - (t.95*se.woman)
lb.women.99 <- 61 + (t.99*se.woman)
ub.women.99 <- 61 - (t.99*se.woman)
lb.women
## 95% CI for women:
.95 ub.women
[1] 69.66837
.95 lb.women
[1] 52.33163
## 99% CI for women
.99 ub.women
[1] 72.74715
.99 lb.women
[1] 49.25285