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

se.X <- 16.71/sqrt(120)

## 95% confidence interval
lb.1 <- -5.09 - (1.96*se.X)
ub.1 <- -5.09 + (1.96*se.X)
lb.1
[1] -8.079798
ub.1
[1] -2.100202
## 99% confidence interva;
lb.2 <- -5.09 - (2.58*se.X)
ub.2 <- -5.09 + (2.58*se.X)
lb.2
[1] -9.025551
ub.2
[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

  1. 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

se.pi <- sqrt(0.61*(1-0.61)/120)

## 95% confidence interval
lb.pi <- 0.61 - (1.96*se.pi)
ub.pi <- 0.61 + (1.96*se.pi)
lb.pi
[1] 0.5227305
ub.pi
[1] 0.6972695
## 99% confidence interval
lb.pi2 <- 0.61 - (2.58*se.pi)
ub.pi2 <- 0.61 + (2.58*se.pi)
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
t.95 <- qt(0.975, df=24)
t.99 <- qt(0.995, df=24)

# CI for men
se.man <- 14/sqrt(25)
ub.men.95 <- 62 + (t.95*se.man)
lb.men.95 <- 62 - (t.95*se.man)
ub.men.99 <- 62 + (t.99*se.man)
lb.men.99 <- 62 - (t.99*se.man)

## 95% CI for men:
ub.men.95 
[1] 67.77892
lb.men.95 
[1] 56.22108
## 99% CI for men
ub.men.99
[1] 69.83143
lb.men.99
[1] 54.16857
# CI for women
se.woman <- 21/sqrt(25)
ub.women.95 <- 61 + (t.95*se.woman)
lb.women.95 <- 61 - (t.95*se.woman)
ub.women.99 <- 61 + (t.99*se.woman)
lb.women.99 <- 61 - (t.99*se.woman)

## 95% CI for women:
ub.women.95 
[1] 69.66837
lb.women.95 
[1] 52.33163
## 99% CI for women
ub.women.99
[1] 72.74715
lb.women.99
[1] 49.25285